note 97264 deleted from function.property-exists by degeberg
| From: | degeberg@php.net | Date: | Sun, 11 Apr 2010 10:59:36 +0000 |
| Subject: | note 97264 deleted from function.property-exists by degeberg | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168129@lists.php.net to get a copy of this message | ||
Note Submitter: MarkAndrewSlade at gmail dot com
Reason: integrated
----
As you would expect, this does not consider the __get magic method in its logic. As a result, if
!property_exists($obj, $prop), you might have a valid value at $obj->$prop.
<?php
class c {
public function __get($key) {
return 'foo';
}
}
$c = new c;
var_dump(property_exists($c, 'prop')); // bool(false)
var_dump($c->prop); // string(3) "foo"
?>