<?php
class C {
private $s;
public function __construct($s) {
$this->s = $s;
}
protected function getS() {
return $this->s;
}
}
class C1 extends C {
function do() {
echo $this->getS();
echo $this->s;
}
}
$c1 = new C1();
$c1->do();
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C::__construct(), 0 passed in /in/JnOvh on line 20 and exactly 1 expected in /in/JnOvh:5
Stack trace:
#0 /in/JnOvh(20): C->__construct()
#1 {main}
thrown in /in/JnOvh on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Warning: Missing argument 1 for C::__construct(), called in /in/JnOvh on line 20 and defined in /in/JnOvh on line 5
Notice: Undefined variable: s in /in/JnOvh on line 6
Notice: Undefined property: C1::$s in /in/JnOvh on line 16
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Parse error: syntax error, unexpected 'do' (T_DO), expecting identifier (T_STRING) in /in/JnOvh on line 14
Process exited with code 255.