Closure object cannot have properties

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 (profile)
Status: Closed Package: Reflection related
PHP Version: 5.3SVN-2009-11-11 (snap) OS: *
Private report: No CVE-ID: None

 [2009-11-11 10:24 UTC] spam04 at pornel dot net

Description:
------------
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:
----------------
false

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


Actual result:
--------------
"Closure object cannot have properties"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2009-11-11 18:59 UTC] felipe@php.net

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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.