<?php
class A
{
private $foo = 'bar';
}
class B extends A
{
public function getFoo()
{
return $this->{chr(0) . 'A' . chr(0) . 'foo'};
}
}
$b = new B();
var_dump($b->getFoo());
Fatal error: Uncaught Error: Cannot access property starting with "\0" in /in/qEUnt:11
Stack trace:
#0 /in/qEUnt(17): B->getFoo()
#1 {main}
thrown in /in/qEUnt on line 11
Process exited with code 255.
Fatal error: Uncaught Error: Cannot access property started with '\0' in /in/qEUnt:11
Stack trace:
#0 /in/qEUnt(17): B->getFoo()
#1 {main}
thrown in /in/qEUnt on line 11
Process exited with code 255.
Fatal error: Cannot access property started with '\0' in /in/qEUnt on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.4
string(3) "bar"
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/qEUnt 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/qEUnt 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/qEUnt on line 4
Process exited with code 255.