#50146 [Opn->Csd]: property_exists: Closure object cannot have properties

From: Date: Wed, 11 Nov 2009 18:59:04 +0000
Subject: #50146 [Opn->Csd]: property_exists: Closure object cannot have properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144487@lists.php.net to get a copy of this message
 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)

« previous php.bugs (#144487) next »