From: zeldorblat at gmail dot com
Operating system: Linux
PHP version: 5CVS-2005-09-06 (CVS)
PHP Bug Type: Class/Object related
Bug description: Using unset on member variable results in __get and __set
being used
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 bug report at http://bugs.php.net/?id=34396&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34396&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34396&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34396&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34396&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34396&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34396&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34396&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34396&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34396&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34396&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34396&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34396&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34396&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34396&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34396&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34396&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34396&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34396&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34396&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34396&r=mysqlcfg