ID: 34396
Updated by: [EMAIL PROTECTED]
Reported By: zeldorblat at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.0.5
New Comment:
See bug #33512
Previous Comments:
------------------------------------------------------------------------
[2005-09-06 19:33:09] zeldorblat at gmail dot com
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!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34396&edit=1