|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-07 11:44 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 21:00:01 2025 UTC |
Description: ------------ If unset() is used on a member variable, subsequent calls to __get and __set take effect as if the variable was not defined as a property. This may be a feature, but the behavior was different in 5.0.4. Reproduce code: --------------- Class A { private $foo = 5; private $x = array(); public function __get($name) { if(!isset($this->x[$name])) echo "Property $name is not set!"; else return $this->x[$name]; } public function bar() { unset($this->foo); return $this->foo; } } $a = new A(); echo $a->bar(); Expected result: ---------------- In PHP 5.0.4: PHP Notice: Undefined variable: foo Actual result: -------------- In PHP 5.0.5: Property foo is not set!