Req #74963 [NEW]: Improve "ErrorException: Trying to get property of non-object" error

From: Date: Fri, 21 Jul 2017 11:26:42 +0000
Subject: Req #74963 [NEW]: Improve "ErrorException: Trying to get property of non-object" error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210165@lists.php.net to get a copy of this message
From: lito at eordes dot com Operating system: All PHP version: Irrelevant Package: Unknown/Other Function Bug Type: Feature/Change Request Bug description:Improve "ErrorException: Trying to get property of non-object" error Description: ------------ I think that is easy to add to core a more detailed debug about errors related with get properties on non objects. Something like "ErrorException: Trying to get property of non-object" could be more useful with "ErrorException: Trying to get property 'name' of non-object". Also, related with "Error: Calling function on non-object" as "Error: Calling function 'getName' on non-object". This change will help to debug problems in conditionals when are using multiples conditions on multiples objects. Test script: --------------- <?php $user = new stdClass; echo $user->level->name; // NOW: ErrorException: Trying to get property of non-object // IMPROVEMENT: ErrorException: Trying to get property 'name' of non-object 'level' -- Edit bug report at https://bugs.php.net/bug.php?id=74963&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74963&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74963&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74963&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74963&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74963&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74963&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74963&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74963&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74963&r=support Expected behavior: https://bugs.php.net/fix.php?id=74963&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74963&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74963&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74963&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74963&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74963&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74963&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74963&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74963&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74963&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74963&r=mysqlcfg

« previous php.bugs (#210165) next »