<?php
class A {
public $b;
public function __construct(B $b) {
$this->b = $b;
}
}
class B {}
class C extends A {
public function __clone() {
$this->b = clone $this->b;
}
}
$a = new A(new B);
$aa = clone $a;
$b = $a;
$c = new C(new B);
$cc = clone $c;
echo "CĂ“PIA\n";
echo "SEM __CLONE\n";
echo "COM __CLONE\n";
PD9waHAKY2xhc3MgQSB7CglwdWJsaWMgJGI7CgkKCXB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdChCICRiKSB7CgkgICAgJHRoaXMtPmIgPSAkYjsKCX0KfQoKY2xhc3MgQiB7fQoKY2xhc3MgQyBleHRlbmRzIEEgewoJcHVibGljIGZ1bmN0aW9uIF9fY2xvbmUoKSB7CgkJJHRoaXMtPmIgPSBjbG9uZSAkdGhpcy0+YjsKCX0KfQoKJGEgPSBuZXcgQShuZXcgQik7CiRhYSA9IGNsb25lICRhOwokYiA9ICRhOwokYyA9IG5ldyBDKG5ldyBCKTsKJGNjID0gY2xvbmUgJGM7CmVjaG8gIkPDk1BJQVxuIjsKdmFyX2R1bXAoJGEgPT09ICRiKTsKdmFyX2R1bXAoJGEtPmIgPT09ICRiLT5iKTsKZWNobyAiU0VNIF9fQ0xPTkVcbiI7CnZhcl9kdW1wKCRhID09PSAkYWEpOwp2YXJfZHVtcCgkYS0+YiA9PT0gJGFhLT5iKTsKZWNobyAiQ09NIF9fQ0xPTkVcbiI7CnZhcl9kdW1wKCRjID09PSAkY2MpOwp2YXJfZHVtcCgkYy0+YiA9PT0gJGNjLT5iKTs=