php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44857 no property_exists() equivalent for magic properties
Submitted: 2008-04-28 18:05 UTC Modified: -
Votes:14
Avg. Score:4.5 ± 0.8
Reproduced:13 of 13 (100.0%)
Same Version:4 (30.8%)
Same OS:5 (38.5%)
From: mike at silverorange dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.2.5 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
48 - 33 = ?
Subscribe to this entry?

 
 [2008-04-28 18:05 UTC] mike at silverorange dot com
Description:
------------
There is currently no way to determine if a magic __get() property exists.

The __isset() function should use 'isset(null) == false' semantics so it cannot be used to reliably check if a magic property exists.

I propose a new magic method __property_exists($name) or __propertyExists($name) be created that hooks into the property_exists() function. It would return true iff __get($name) returns any value.


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jun 01 06:01:26 2020 UTC