#29923 [Opn->Bgs]: Assignment operations inside class methods not working

From: Date: Wed, 01 Sep 2004 07:38:40 +0000
Subject: #29923 [Opn->Bgs]: Assignment operations inside class methods not working
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-65554@lists.php.net to get a copy of this message
ID: 29923 User updated by: bugs dot php dot net at chsc dot dk Reported By: bugs dot php dot net at chsc dot dk -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 5.0.1 New Comment: Marking Bogus Previous Comments: ------------------------------------------------------------------------ [2004-09-01 09:29:18] bugs dot php dot net at chsc dot dk Sorry, it's not a bug in PHP but in the Zend Optimizer. Changing zend_optimizer.optimization_level from 15 to 0 in php.ini fixes the problem. We'll report this to Zend. ------------------------------------------------------------------------ [2004-09-01 08:39:24] derick@php.net Extra note: this works fine for me. ------------------------------------------------------------------------ [2004-09-01 08:39:09] derick@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip ------------------------------------------------------------------------ [2004-08-31 19:24:44] bugs dot php dot net at chsc dot dk Description: ------------ When called from inside a class method, $this->foo += 2 does not increment the variable. $this->foo = $this->foo + 2 appears to work, though. This looks related to bug 27798. Reproduce code: --------------- <?php class foo { var $bar = 1; function baz() { $this->bar += 2; var_dump($this->bar); var_dump(get_object_vars($this)); } } $f = new foo(); $f->baz(); $f->bar += 4; var_dump($f->bar); ?> Expected result: ---------------- int(3) array(1) { ["bar"]=> int(3) } int(7) Actual result: -------------- int(1) array(2) { ["bar"]=> int(1) [0]=> int(2) } int(5) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29923&edit=1

« previous php.bugs (#65554) next »