ID: 11800
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 4.0.6
New Comment:
This is fixed in CVS.
You just have to use:
call_user_func(array(&$t, "increase"));
instead though.
--Jani
Previous Comments:
------------------------------------------------------------------------
[2001-06-29 09:02:13] [EMAIL PROTECTED]
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 this bug report at http://bugs.php.net/?id=11800&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]