<?php
class B {
public function __toString() {
echo ".".__CLASS__;
}
}
class A extends B {
public function __toString() {
echo ".".__CLASS__;
}
}
echo new A();
.A
Fatal error: Uncaught TypeError: A::__toString(): Return value must be of type string, none returned in /in/ooZsf:10
Stack trace:
#0 /in/ooZsf(13): A->__toString()
#1 {main}
thrown in /in/ooZsf on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
.A
Fatal error: Uncaught Error: Method A::__toString() must return a string value in /in/ooZsf:13
Stack trace:
#0 {main}
thrown in /in/ooZsf on line 13
Process exited with code 255.
.A
Catchable fatal error: Method A::__toString() must return a string value in /in/ooZsf on line 13
Process exited with code 255.
Output for 5.0.5, 5.1.0 - 5.1.6
.A
Fatal error: Method A::__toString() must return a string value in /in/ooZsf on line 13
Process exited with code 255.
Output for 5.0.0 - 5.0.4
.A Process exited with code 139.
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/ooZsf on line 3
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/ooZsf on line 3
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/ooZsf on line 3
Process exited with code 255.