Category
stdlib · php-src-strict
Problem
class_exists('ArrayObject') is true, but ArrayObject::__construct() is not registered (method_exists('ArrayObject', '__construct') → false). Subclasses calling parent::__construct([...]) fatal; new ArrayObject($array) cannot initialize storage. Countable::count() on instances also fails (Call to undefined method ArrayObject::count()).
Umbrella #3330 tracks full SPL parity; this issue is the minimal constructor + count slice workers can land first.
php-src reference
Repro (failure today — verified 2026-06-19)
<?php
declare(strict_types=1);
// Direct construct
$o = new ArrayObject([1, 2]);
echo count($o), "\n";
// Subclass parent::__construct
$anon = new class extends ArrayObject {
public function __construct() { parent::__construct([1, 2]); }
};
echo count($anon), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(method_exists(\"ArrayObject\",\"__construct\")); echo PHP_EOL;"
php bin/vm.php repro.php 2>&1 | head -5
php repro.php
'
| Check |
Zend PHP 8.x |
VM today |
method_exists('ArrayObject','__construct') |
true |
false ❌ |
count(new ArrayObject([1,2])) |
2 |
fatal ❌ |
Anonymous extends ArrayObject + parent::__construct |
2 |
Call to undefined static method arrayobject::__construct() ❌ |
Scope (this repo)
| Layer |
Path |
| Builtin class |
ext/spl/BuiltinClasses.php, VmArrayObject.php (new) |
| VM |
Wrap internal array zval / HashTable — reuse lib/VM/HashTable.php |
| Registry |
ext/spl/Module.php or shared SPL loader (#3330) |
| JIT/AOT |
defer v1; document VM-only in capability matrix |
PHP-in-PHP first: no C object layout in runtime/.
Done when
Category
stdlib· php-src-strictProblem
class_exists('ArrayObject')is true, butArrayObject::__construct()is not registered (method_exists('ArrayObject', '__construct')→ false). Subclasses callingparent::__construct([...])fatal;new ArrayObject($array)cannot initialize storage.Countable::count()on instances also fails (Call to undefined method ArrayObject::count()).Umbrella #3330 tracks full SPL parity; this issue is the minimal constructor + count slice workers can land first.
php-src reference
ext/spl/spl_array.c—spl_array_object_construct,spl_array_object_count_elementsext/spl/spl_array.h— internal array storageext/spl/tests/arrayobject_*.phptRepro (failure today — verified 2026-06-19)
method_exists('ArrayObject','__construct')truefalse❌count(new ArrayObject([1,2]))2extends ArrayObject+parent::__construct2Call to undefined static method arrayobject::__construct()❌Scope (this repo)
ext/spl/BuiltinClasses.php,VmArrayObject.php(new)lib/VM/HashTable.phpext/spl/Module.phpor shared SPL loader (#3330)PHP-in-PHP first: no C object layout in
runtime/.Done when
new ArrayObject([1, 2])+count()returns2onbin/vm.phpparent::__construct($array)workstest/compliance/cases/stdlib/arrayobject_construct.phptgreen./script/ci-fast.sh --filter arrayobject_constructgreen