<?php
class Bar
{
public $indicator;
public function __construct($x)
{
$this->indicator = $x;
}
}
class Foo
{
protected $prop;
public function __construct(Bar $prop)
{
$this->prop = $prop;
}
public function getProp()
{
return $this->prop;
}
}
$objX = new Foo(new Bar('one'));
$objY = clone $objX;
$objY->getProp()->indicator = 'two';
//two, since cloned object still tracks references inside it:
echo $objX->getProp()->indicator;
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/Ll2b8 on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/Ll2b8 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/Ll2b8 on line 5
Process exited with code 255.