<?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($s1) {
parent::__construct($s1);
}
function doStuff() {
echo $this->getS();
echo $this->s;
}
}
$c1 = new C1();
$c1->doStuff();
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C1::__construct(), 0 passed in /in/KGNs1 on line 23 and exactly 1 expected in /in/KGNs1:14
Stack trace:
#0 /in/KGNs1(23): C1->__construct()
#1 {main}
thrown in /in/KGNs1 on line 14
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C1::__construct(), 0 passed in /in/KGNs1 on line 23 and exactly 1 expected in /in/KGNs1:14
Stack trace:
#0 /in/KGNs1(23): C1->__construct()
#1 {main}
thrown in /in/KGNs1 on line 14
Process exited with code 255.
Warning: Missing argument 1 for C1::__construct(), called in /in/KGNs1 on line 23 and defined in /in/KGNs1 on line 14
Notice: Undefined variable: s1 in /in/KGNs1 on line 15
Notice: Undefined property: C1::$s in /in/KGNs1 on line 19