Category
language · php-src-strict · constructors
Problem
Calling parent::__construct() when the parent class declares no constructor must throw Error: Cannot call constructor (Zend). VM/JIT throw a different Error shaped like a missing static method, with a lowercased class name.
Probed 2026-07-31 Zend 8.2.32 vs bin/vm.php / bin/jit.php @ fad4609ee.
| Repro |
Zend 8.2 |
VM/JIT |
parent::__construct() in child of empty parent |
Error:Cannot call constructor |
Error:Call to undefined static method parentnoctor::__construct() |
class ParentNoCtor {}
class Child extends ParentNoCtor {
public function __construct() { parent::__construct(); }
}
new Child; // Zend: Cannot call constructor
php-src reference
PHP implementation target
- Parent ctor dispatch in
lib/VM + JIT call lowering: when parent has no __construct, throw Zend’s Cannot call constructor (not undefined-static-method)
- PHP-in-PHP; no new C
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php; php bin/vm.php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php; php bin/jit.php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php'
Done when
Category
language· php-src-strict · constructorsProblem
Calling
parent::__construct()when the parent class declares no constructor must throwError: Cannot call constructor(Zend). VM/JIT throw a differentErrorshaped like a missing static method, with a lowercased class name.Probed 2026-07-31 Zend 8.2.32 vs
bin/vm.php/bin/jit.php@fad4609ee.parent::__construct()in child of empty parentError:Cannot call constructorError:Call to undefined static method parentnoctor::__construct()php-src reference
Zend/zend_object_handlers.c— constructor call /Cannot call constructorZend/zend_execute.c—ZEND_DO_FCALLparent ctor special casePHP implementation target
lib/VM+ JIT call lowering: when parent has no__construct, throw Zend’sCannot call constructor(not undefined-static-method)Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php; php bin/vm.php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php; php bin/jit.php test/repro/maintainer_gap_parent_construct_no_parent_ctor.php'Done when
Cannot call constructor(Error) on VM + JIT