#34372 [Opn->WFx]: varibles of A class why not change?
| From: | sniper@php.net | Date: | Mon, 05 Sep 2005 06:52:08 +0000 |
| Subject: | #34372 [Opn->WFx]: varibles of A class why not change? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84534@lists.php.net to get a copy of this message | ||
ID: 34372
Updated by: sniper@php.net
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