<?php
class A {
private $str = "Pysh!..";
public function f() {
B::g();
}
}
class B {
private $str = "Ololo!..";
public function g() {
print($this->str."\n");
}
}
(new A)->f();
Fatal error: Uncaught Error: Non-static method B::g() cannot be called statically in /in/E8Vil:7
Stack trace:
#0 /in/E8Vil(19): A->f()
#1 {main}
thrown in /in/E8Vil on line 7
Process exited with code 255.
Deprecated: Non-static method B::g() should not be called statically in /in/E8Vil on line 7
Fatal error: Uncaught Error: Using $this when not in object context in /in/E8Vil:15
Stack trace:
#0 /in/E8Vil(7): B::g()
#1 /in/E8Vil(19): A->f()
#2 {main}
thrown in /in/E8Vil on line 15
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Using $this when not in object context in /in/E8Vil:15
Stack trace:
#0 /in/E8Vil(7): B::g()
#1 /in/E8Vil(19): A->f()
#2 {main}
thrown in /in/E8Vil on line 15
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Deprecated: Non-static method B::g() should not be called statically, assuming $this from incompatible context in /in/E8Vil on line 7
Fatal error: Cannot access private property A::$str in /in/E8Vil on line 15
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Strict Standards: Non-static method B::g() should not be called statically, assuming $this from incompatible context in /in/E8Vil on line 7
Fatal error: Cannot access private property A::$str in /in/E8Vil on line 15
Process exited with code 255.
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/E8Vil on line 19
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/E8Vil on line 19
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/E8Vil 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/E8Vil 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/E8Vil on line 4
Process exited with code 255.