note 97264 added to function.property-exists
| From: | MarkAndrewSlade at gmail dot com | Date: | Sun, 11 Apr 2010 01:18:41 +0000 |
| Subject: | note 97264 added to function.property-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168114@lists.php.net to get a copy of this message | ||
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"
?>
----
Server IP: 192.41.40.227
Probable Submitter: 68.204.110.90
----
Manual Page -- http://www.php.net/manual/en/function.property-exists.php
Edit -- https://master.php.net/note/edit/97264
Del: integrated -- https://master.php.net/note/delete/97264/integrated
Del: useless -- https://master.php.net/note/delete/97264/useless
Del: bad code -- https://master.php.net/note/delete/97264/bad+code
Del: spam -- https://master.php.net/note/delete/97264/spam
Del: non-english -- https://master.php.net/note/delete/97264/non-english
Del: in docs -- https://master.php.net/note/delete/97264/in+docs
Del: other reasons-- https://master.php.net/note/delete/97264
Reject -- https://master.php.net/note/reject/97264
Search -- https://master.php.net/manage/user-notes.php