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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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 Jan 20 12:01:23 2020 UTC