#32264 [NEW]: refcount is not updated
| From: | tangi dot maury at wanadoo dot fr | Date: | Thu, 10 Mar 2005 15:27:49 +0000 |
| Subject: | #32264 [NEW]: refcount is not updated | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75211@lists.php.net to get a copy of this message | ||
From: tangi dot maury at wanadoo dot fr
Operating system: windows 2000
PHP version: 4.3.9
PHP Bug Type: Class/Object related
Bug description: refcount is not updated
Description:
------------
I'd like use '=null' on variables who points to object.
but the refcount is not updated in this case.
It is updated only after unset on variable.
is it a real pb ?
By,
Reproduce code:
---------------
a small test ->
class a{
}
class b extends a{
}
class t{
var $r = null;
var $pr = null;
function test(){
$this->r = &new b();
echo "nb Ref r apres new = " . pars_infoo($this->r);
$this->pr = &$this->r;
echo "<br/>nb Ref pr apres pr = " . pars_infoo($this->r);
echo "<br/>nb Ref r apres pr = " . pars_infoo($this->pr);
//unset($this->pr); OK
$this->pr = null;
echo "<br/> nb Ref r apres unset " . pars_infoo($this->r);
}
}
$b= new t();
$b->test();
source for pars_infoo(Zend)
if ((*pO)->is_ref)
ret = strUWFormat(ret, nPos, &nPos, "nb référence = %hd",
(*pO)->refcount);
Expected result:
----------------
if i make unset it's ok
->
nb Ref r apres unset nb référence = 2 <- ok
Actual result:
--------------
->
nb Ref r apres new = nb référence = 2
nb Ref pr apres pr = nb référence = 3
nb Ref r apres pr = nb référence = 3
nb Ref r apres unset nb référence = 3 <- wrong
--
Edit bug report at http://bugs.php.net/?id=32264&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32264&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32264&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32264&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32264&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32264&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32264&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32264&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32264&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32264&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32264&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32264&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32264&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32264&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32264&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32264&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32264&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32264&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32264&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32264&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32264&r=mysqlcfg