<?php
class Base {
public function __construct() { echo 1; }
}
class Base2 {
public function __construct() { parent::__construct(); echo 2; }
}
abstract class Abs extends Base2 {
}
class Top extends Abs {
public function __construct() { parent::__construct(); echo 3; }
}
$t = new Top();
Fatal error: Cannot use "parent" when current class scope has no parent in /in/JrIDD on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Deprecated: Cannot use "parent" when current class scope has no parent in /in/JrIDD on line 8
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/JrIDD:8
Stack trace:
#0 /in/JrIDD(16): Base2->__construct()
#1 /in/JrIDD(19): Top->__construct()
#2 {main}
thrown in /in/JrIDD on line 8
Process exited with code 255.
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/JrIDD:8
Stack trace:
#0 /in/JrIDD(16): Base2->__construct()
#1 /in/JrIDD(19): Top->__construct()
#2 {main}
thrown in /in/JrIDD on line 8
Process exited with code 255.
Fatal error: Cannot access parent:: when current class scope has no parent in /in/JrIDD on line 8
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/JrIDD 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/JrIDD 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/JrIDD on line 4
Process exited with code 255.