<?php
class C {
private $s;
public function __construct($s) {
$this->s = $s;
}
protected function getS() {
return $this->s;
}
}
class C1 extends C {
public function __construct($s) {
super::__construct($s);
}
function do() {
echo $this->getS();
echo $this->s;
}
}
$c1 = new C1();
$c1->do();
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C1::__construct(), 0 passed in /in/NIVGC on line 23 and exactly 1 expected in /in/NIVGC:14
Stack trace:
#0 /in/NIVGC(23): C1->__construct()
#1 {main}
thrown in /in/NIVGC on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Missing argument 1 for C1::__construct(), called in /in/NIVGC on line 23 and defined in /in/NIVGC on line 14
Fatal error: Uncaught Error: Class 'super' not found in /in/NIVGC:15
Stack trace:
#0 /in/NIVGC(23): C1->__construct()
#1 {main}
thrown in /in/NIVGC on line 15
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Parse error: syntax error, unexpected 'do' (T_DO), expecting identifier (T_STRING) in /in/NIVGC on line 17
Process exited with code 255.