<?php class A { public $elements = []; public function __clone() { // $elems = $this->elements; unset($this->elements); $this->elements = $elems; // this is a working fix before fixed in PHP directly } } $x = new A(); $test = &$x->elements; // this code outside class causes a different clone behaviour $y = clone $x; $y->elements['hello'] = 'world'; print_r($x); print_r($y);
You have javascript disabled. You will not be able to edit any code.