ID: 42611
User updated by: johnny at netvor dot sk
Reported By: johnny at netvor dot sk
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: all
PHP Version: 5.2.4
New Comment:
PEBCAC
Previous Comments:
------------------------------------------------------------------------
[2007-09-11 02:32:53] judas dot iscariote at gmail dot com
Please, read your code, this is the expected behaviuor, there is a bug
in your code.
accessing:
private $data;
as:
$data[$name]
will not work for sure ;) $this->data[$name] will ;)
------------------------------------------------------------------------
[2007-09-10 13:36:55] johnny at netvor dot sk
Description:
------------
calling unary increment operator (++) on unset overloaded member
variable leaves variable unset instead of setting it to 1
Reproduce code:
---------------
<?php
class A {
public $v;
}
class B {
private $data;
public function __set ($name, $value) {
$data[$name] = $value;
}
public function __get ($name) {
return $data[$name];
}
}
$a = new A ();
$b = new B ();
$a->v++;
$b->v++;
echo "\$a->v is: {$a->v}<br/>";
echo "\$b->v is: {$b->v}<br/>";
?>
Expected result:
----------------
$a->v is: 1
$b->v is: 1
Actual result:
--------------
$a->v is: 1
$b->v is:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42611&edit=1