|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74963 Improve "ErrorException: Trying to get property of non-object" error
Submitted: 2017-07-21 11:26 UTC Modified: 2017-07-31 03:57 UTC
From: lito at eordes dot com Assigned: laruence (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 + 17 = ?
Subscribe to this entry?

 [2017-07-21 11:26 UTC] lito at eordes dot com
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:
$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'


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-31 03:57 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2017-07-31 03:57 UTC]
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

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Nov 30 10:03:44 2022 UTC