#50146 [Opn->Csd]: property_exists: Closure object cannot have properties
ID: 50146
Updated by: felipe@php.net
Reported By: spam04 at pornel dot net
-Status: Open
+Status: Closed
Bug Type: Reflection related
Operating System: *
PHP Version: 5.3SVN-2009-11-11 (snap)
-Assigned To:
+Assigned To: felipe
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-11-11 10:24:24] 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"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50146&edit=1
Thread (2 messages)