|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50146 property_exists: Closure object cannot have properties
Submitted: 2009-11-11 10:24 UTC Modified: 2009-11-11 18:59 UTC
From: spam04 at pornel dot net Assigned: felipe
Status: Closed Package: Reflection related
PHP Version: 5.3SVN-2009-11-11 (snap) OS: *
Private report: No CVE-ID:
 [2009-11-11 10:24 UTC] spam04 at pornel dot net
property_exists() rejects closures with "Closure object cannot have properties" rather than simply always returning false.

Since closures pass is_object() test, it's hard to avoid this error without testing for "instanceof Closure" as well, which is discouraged in the docs.

Reproduce code:
$obj = function(){}

is_object($obj) && property_exists($obj,'foo');

Expected result:

(either they should not be considered objects, or property_exists should accept any object).

Actual result:
"Closure object cannot have properties"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-11 18:59 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2009-11-11 18:59 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #50146 (property_exists: Closure object cannot have properties)
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 05:01:53 2015 UTC