#29923 [Fbk]: Assignment operations inside class methods not working
| From: | derick@php.net | Date: | Wed, 01 Sep 2004 06:39:24 +0000 |
| Subject: | #29923 [Fbk]: Assignment operations inside class methods not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65547@lists.php.net to get a copy of this message | ||
ID: 29923
Updated by: derick@php.net
Reported By: bugs dot php dot net at chsc dot dk
Status: Feedback
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 5.0.1
New Comment:
Extra note: this works fine for me.
Previous Comments:
------------------------------------------------------------------------
[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