php.net |  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 (profile)
Status: Closed Package: Reflection related
PHP Version: 5.3SVN-2009-11-11 (snap) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spam04 at pornel dot net
New email:
PHP Version: OS:

 

 [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.


 [2009-11-11 18:59 UTC] svn@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=290516
Log: - Fixed bug #50146 (property_exists: Closure object cannot have properties)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC