PHP 4.0 Bug #9090: call_user_method() duplicates object
| From: | cazzell at eng dot usf dot edu | Date: | Sat, 03 Feb 2001 22:21:00 +0000 |
| Subject: | PHP 4.0 Bug #9090: call_user_method() duplicates object | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45686@lists.php.net to get a copy of this message | ||
From: cazzell@eng.usf.edu
Operating system: linux 2.4
PHP version: 4.0.4pl1
PHP Bug Type: Class/Object related
Bug description: call_user_method() duplicates object
First some sample code:
class foo {
var $bar = 0;
function increase () {
$this->bar++;
}
}
$foo = new foo;
print "Bar: " . $foo->bar . "\n";
call_user_method('increase', $foo);
print "Bar: " . $foo->bar . "\n";
$foo->increase();
print "Bar: " . $foo->bar . "\n";
This will output:
Bar: 0
Bar: 0
Bar: 1
It appears that call_user_method is working on a copy of the object rather than the object itself.
--
Edit Bug report at: http://bugs.php.net/?id=9090&edit=1