[PHP-DEV] Bug #11800: call_user_method() bug (it won't change properties) From: bachi2 <email protected>
Date: 06/29/01

From: bachi2 <email protected>
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

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>