ID: 34372
Updated by: [EMAIL PROTECTED]
Reported By: hightman2 at yahoo dot com dot cn
-Status: Open
+Status: Wont fix
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 4.4.0
New Comment:
That's what you get with playing around with references and objects in
PHP 4. Fixed in PHP 5.1 and above. Wont fix elsewhere.
Previous Comments:
------------------------------------------------------------------------
[2005-09-05 06:15:28] hightman2 at yahoo dot com dot cn
Description:
------------
the object's method was called as 'call back' function
Reproduce code:
---------------
<?php
class hello {
var $me;
function hello() {
$this->me = 1;
register_shutdown_function(array(&$this, 'show'));
}
function show() {
echo $this->me . "\n";
}
function add() {
$this->me++;
}
}
$h = new hello;
$h->add();
echo "real value: ";
$h->show();
echo "cb value: ";
?>
Expected result:
----------------
real value: 2
cb value: 2
Actual result:
--------------
real value: 2
cb value: 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34372&edit=1