<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
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();
?>
Fatal error: Uncaught Error: Non-static method Class1::foo() cannot be called statically in /in/8F5Pj:26
Stack trace:
#0 /in/8F5Pj(33): Class2->bar()
#1 {main}
thrown in /in/8F5Pj on line 26
Process exited with code 255.
Fatal error: Uncaught Error: Using $this when not in object context in /in/8F5Pj:10
Stack trace:
#0 /in/8F5Pj(26): Class1::foo()
#1 /in/8F5Pj(33): Class2->bar()
#2 {main}
thrown in /in/8F5Pj on line 10
Process exited with code 255.
Fatal error: Call to undefined method Class2::foo2() in /in/8F5Pj 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/8F5Pj on line 7
Fatal error: Call to undefined method Class2::foo2() in /in/8F5Pj 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/8F5Pj 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/8F5Pj 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/8F5Pj on line 10