<?php
error_reporting(E_ALL);
class Class1 {
var $testVar = 5;
function foo(){
echo $this->foo2();
}
function foo2(){
}
}
class Class2 {
function __construct(){
$this->class1 = new Class1();
}
function bar(){
//This doesn't report an error because error level 'strict' is disabled.
Class1::foo();
}
}
$class2 = new Class2();
$class2->bar();
?>
Deprecated: Creation of dynamic property Class2::$class1 is deprecated in /in/P7jSP on line 21
Fatal error: Uncaught Error: Non-static method Class1::foo() cannot be called statically in /in/P7jSP:26
Stack trace:
#0 /in/P7jSP(33): Class2->bar()
#1 {main}
thrown in /in/P7jSP on line 26
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught Error: Non-static method Class1::foo() cannot be called statically in /in/P7jSP:26
Stack trace:
#0 /in/P7jSP(33): Class2->bar()
#1 {main}
thrown in /in/P7jSP on line 26
Process exited with code 255.
Deprecated: Non-static method Class1::foo() should not be called statically in /in/P7jSP on line 26
Fatal error: Uncaught Error: Using $this when not in object context in /in/P7jSP:10
Stack trace:
#0 /in/P7jSP(26): Class1::foo()
#1 /in/P7jSP(33): Class2->bar()
#2 {main}
thrown in /in/P7jSP on line 10
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Deprecated: Non-static method Class1::foo() should not be called statically, assuming $this from incompatible context in /in/P7jSP on line 26
Fatal error: Call to undefined method Class2::foo2() in /in/P7jSP on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Strict Standards: Non-static method Class1::foo() should not be called statically, assuming $this from incompatible context in /in/P7jSP on line 26
Fatal error: Call to undefined method Class2::foo2() in /in/P7jSP on line 10
Process exited with code 255.
Fatal error: Call to undefined method Class2::foo2() in /in/P7jSP on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/P7jSP on line 7
Fatal error: Call to undefined method Class2::foo2() in /in/P7jSP on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined method: class2->foo2() in /in/P7jSP on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: foo2() in /in/P7jSP on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: foo2() in /in/P7jSP on line 10