<?php
class MyClass {
public function test() {echo __METHOD__ . "\n";}
public static function testStatic() {echo __METHOD__ . "\n";}
}
class MyClass2 {
public function test() {echo __METHOD__ . "\n"; call_user_func('parent::test'); }
public static function testStatic() {echo __METHOD__ . "\n"; call_user_func('parent::testStatic'); call_user_func('static::testLate');}
}
class MyClass3 {
public static function testLate() {echo __METHOD__ . "\n";}
}
echo "call object method:\n";
$o = new MyClass3();
$o->test();
$o->testStatic();
echo "call static method:\n";
MyClass3::testStatic();
call object method:
Fatal error: Uncaught Error: Call to undefined method MyClass3::test() in /in/Cv2oc:19
Stack trace:
#0 {main}
thrown in /in/Cv2oc on line 19
Process exited with code 255.
call object method:
Fatal error: Call to undefined method MyClass3::test() in /in/Cv2oc 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/Cv2oc 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/Cv2oc 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/Cv2oc on line 4
Process exited with code 255.