1--TEST-- 2Bug #72229 (Wrong reference when serialize/unserialize an object) 3--FILE-- 4<?php 5class C1 6{ 7 public $arr1 = array(); 8 public $arr2 = array(); 9 public function __construct() 10 { 11 $this->arr1[0] = $this; 12 $this->arr2[0] = $this->arr1[0]; 13 $var1 = &$this->arr1[0]; // Set a reference... 14 unset($var1); // ... and unset it. 15 } 16} 17$Obj1 = new C1(); 18$txt1 = serialize($Obj1); 19$Obj2 = unserialize($txt1); 20$Obj1->arr2[0] = 50; 21print_r($Obj1); 22$Obj2->arr2[0] = 50; 23print_r($Obj2); 24?> 25--EXPECTF-- 26C1 Object 27( 28 [arr1] => Array 29 ( 30 [0] => C1 Object 31 *RECURSION* 32 ) 33 34 [arr2] => Array 35 ( 36 [0] => 50 37 ) 38 39) 40C1 Object 41( 42 [arr1] => Array 43 ( 44 [0] => C1 Object 45 *RECURSION* 46 ) 47 48 [arr2] => Array 49 ( 50 [0] => 50 51 ) 52 53) 54