• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need verbose logging in system/core/Model.php for "Cannot access empty property" bug

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;

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.