|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: lito at eordes dot com
New email:
PHP Version: OS:


 [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: Sun Dec 04 12:03:58 2022 UTC