<?php
class MyClass
{
private $privateProperty;
public function setPrivateProperty($prop)
{
$this->privateProperty = $prop;
}
public function evaluate(MyClass $object)
{
var_dump($object->privateProperty);
}
}
$obj1 = (new MyClass)->setPrivateProperty('foo');
$obj2 = (new MyClass)->setPrivateProperty('bar');
$obj1->evaluate($obj2);
Fatal error: Uncaught Error: Call to a member function evaluate() on null in /in/5nrMp:20
Stack trace:
#0 {main}
thrown in /in/5nrMp on line 20
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Fatal error: Call to a member function evaluate() on null in /in/5nrMp on line 20
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Fatal error: Call to a member function evaluate() on a non-object in /in/5nrMp on line 20
Process exited with code 255.
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/5nrMp on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/5nrMp on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/5nrMp on line 4
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/5nrMp on line 4
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/5nrMp on line 4
Process exited with code 255.