Bug #11800: call_user_method() bug (it won't change properties)
| From: | bachi2 at insign dot ch | Date: | Fri, 29 Jun 2001 13:02:13 +0000 |
| Subject: | Bug #11800: call_user_method() bug (it won't change properties) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-58412@lists.php.net to get a copy of this message | ||
From: bachi2@insign.ch
Operating system: Linux
PHP version: 4.0.6
PHP Bug Type: Class/Object related
Bug description: call_user_method() bug (it won't change properties)
I've run into this already a year ago and now again: The call_user_method() function does not
correctly change the properties of the object it's called upon - OR (what I assume) it copies
the called object. Just try the code below - the counter remains on 4, not 6 as supposed.
(I also tried to pass the obj. by reference: call_user_method ("increase", &$t); - it
didn't help)
class test
{
var $a=0;
function increase()
{
$this->a++;
echo "a is now: ".$this->a."\n
";
}
}
$t = new test();
echo "Direct calls:\n
";
$t->increase();
$t->increase();
$t->increase();
echo "
\n\nIndirect calls:\n
";
call_user_method ("increase", $t);
call_user_method ("increase", $t);
call_user_method ("increase", $t);
--
Edit Bug report at: http://bugs.php.net/?id=11800&edit=1