[php-src] Issue #9760: ArrayIterator constructor creates undeclared property `private storage`

From: Date: Sun, 16 Oct 2022 23:13:41 +0000
Subject: [php-src] Issue #9760: ArrayIterator constructor creates undeclared property `private storage`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242609@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9760 Author: TysonAndre ### Description The following code: ```php <?php var_dump(new ArrayIterator()); var_dump((new ReflectionClass('ArrayIterator'))->getProperties()); ``` Resulted in this output: ``` object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(0) { } } array(0) { } ``` But I expected this output instead: ``` object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(0) { } } array(1) { ReflectionProperty info for "storage"... } ``` Because https://wiki.php.net/rfc/deprecate_dynamic_properties passed in php 8.2, I would expect us to stop declaring this. The warning was not emitted because ArrayIterator writes to the properties hash table directly ```c // ext/spl/spl_array.c storage = &intern->array; Z_TRY_ADDREF_P(storage); base = obj->handlers == &spl_handler_ArrayIterator ? spl_ce_ArrayIterator : spl_ce_ArrayObject; zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1); zend_symtable_update(debug_info, zname, storage); zend_string_release_ex(zname, 0); ``` Solution: Declare the file in stubs and regenerate stubs ### PHP Version 8.2+ ### Operating System _No response_

« previous php.bugs (#242609) next »