From:             [EMAIL PROTECTED]
Operating system: *
PHP version:      6CVS-2005-11-16 (CVS)
PHP Bug Type:     Scripting Engine problem
Bug description:  Objects can lose references

Description:
------------
Assignment by reference to property may lose reference.

Reproduce code:
---------------
<?php
$a = new stdClass; 
$a->x0 = new stdClass;
$a->x0->y0 = 'a';
$a->x0->y1 =& $a->x0;
$a->x0->y2 =& $a->x0;
$a->x0->y0 = 'b';
var_dump($a);
?>

Expected result:
----------------
object(stdClass)#1 (1) {
  ["x0"]=>
  &object(stdClass)#2 (3) {
    ["y0"]=>
    string(1) "b"
    ["y1"]=>
    &object(stdClass)#2 (3) {
      ["y0"]=>
      string(1) "b"
      ["y1"]=>
      *RECURSION*
      ["y2"]=>
      *RECURSION*
    }
    ["y2"]=>
    &object(stdClass)#2 (3) {
      ["y0"]=>
      string(1) "b"
      ["y1"]=>
      *RECURSION*
      ["y2"]=>
      *RECURSION*
    }
  }
}


Actual result:
--------------
object(stdClass)#1 (1) {
  ["x0"]=>
  object(stdClass)#2 (3) {
    ["y0"]=>
    string(1) "b"
    ["y1"]=>
    object(stdClass)#2 (3) {
      ["y0"]=>
      string(1) "b"
      ["y1"]=>
      *RECURSION*
      ["y2"]=>
      *RECURSION*
    }
    ["y2"]=>
    object(stdClass)#2 (3) {
      ["y0"]=>
      string(1) "b"
      ["y1"]=>
      *RECURSION*
      ["y2"]=>
      *RECURSION*
    }
  }
}
/home/dmitry/php/php5.1/Zend/zend_vm_execute.h(393) :  Freeing 0x08B29C94
(16 bytes), script=ass4.php
=== Total 1 memory leaks detected ===


-- 
Edit bug report at http://bugs.php.net/?id=35239&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35239&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35239&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35239&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=35239&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=35239&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=35239&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=35239&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=35239&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=35239&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=35239&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=35239&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=35239&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=35239&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35239&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=35239&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=35239&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=35239&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35239&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=35239&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35239&r=mysqlcfg

Reply via email to