<?php
unset($this);
class Foo{
private static $this;
protected $a = true;
public function __construct(){
self::$this = new Foo(func_get_args());
echo "From Foo()";
}
public static function init(){
//var_dump(new Foo);
var_dump(self::$this->test());
echo "From Foo::init()";
}
public function test(){
echo "called from static";
}
}
Foo::init();
Fatal error: Cannot unset $this in /in/gabXB on line 2
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Fatal error: Uncaught Error: Call to a member function test() on null in /in/gabXB:12
Stack trace:
#0 /in/gabXB(19): Foo::init()
#1 {main}
thrown in /in/gabXB on line 12
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Fatal error: Call to a member function test() on null in /in/gabXB on line 12
Process exited with code 255.
Output for 5.4.22 - 5.4.45, 5.5.6 - 5.5.38
Fatal error: Call to a member function test() on a non-object in /in/gabXB on line 12
Process exited with code 255.
Fatal error: Cannot re-assign $this in /in/gabXB on line 7
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/gabXB 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/gabXB 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/gabXB on line 4
Process exited with code 255.