Welcome Guest, Not a member yet? Register   Sign In
Need verbose logging in system/core/Model.php for "Cannot access empty property" bug
#1

Please implement something along the following into system/core/Model.php. In large programs it can be a pain and next to impossible using php error logs alone to track down an empty property call. This will trace back to the exact line trying to access an empty key. Or at least add something other than a comment stating we have a typo somewhere. Thanks.

PHP Code:
public function __get($key)
 {
 if (!isset(
get_instance()->$key)) {
 
$e = new Exception();
 
$backTrace $e->getTraceAsString();

 
log_message('error'"Attempting to access empty key: {$backTrace}");
 }

 
// Debugging note:
 // If you're here because you're getting an error message
 // saying 'Undefined Property: system/core/Model.php', it's
 // most likely a typo in your model code.
 
return get_instance()->$key;
 } 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB