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

From: Date: Mon, 31 Jul 2017 03:57:59 +0000
Subject: Req #74963 [Opn->Csd]: Improve "ErrorException: Trying to get property of non-object" error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210421@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74963&edit=1 ID: 74963 Updated by: laruence@php.net Reported by: lito at eordes dot com Summary: Improve "ErrorException: Trying to get property of non-object" error -Status: Open +Status: Closed Type: Feature/Change Request Package: Unknown/Other Function Operating System: All PHP Version: Irrelevant -Assigned To: +Assigned To: laruence Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2017-07-21 11:26:39] lito at eordes dot com 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 this bug report at https://bugs.php.net/bug.php?id=74963&edit=1

« previous php.bugs (#210421) next »