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 commits
[2009-11-11 18:59 UTC] felipe@php.net