|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-11 02:32 UTC] judas dot iscariote at gmail dot com
[2007-09-11 07:09 UTC] johnny at netvor dot sk
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 15:00:01 2025 UTC |
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: