From:             bugs dot php dot net at chsc dot dk
Operating system: Linux
PHP version:      5.0.1
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Assignment operations inside class methods not working

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 bug report at http://bugs.php.net/?id=29923&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=29923&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29923&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29923&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=29923&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=29923&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=29923&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=29923&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=29923&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=29923&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=29923&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=29923&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=29923&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=29923&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=29923&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=29923&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=29923&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=29923&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=29923&r=float

Reply via email to