php / php-src

The PHP Interpreter
https://www.php.net
Other
38.22k stars 7.75k forks source link

Appending to a list should maintain list #15966

Open mvorisek opened 1 month ago

mvorisek commented 1 month ago

Description

repro: https://3v4l.org/fV80Z

I know historically there is internal "next free index variable", but array with 0...n-1 keys should stay list even when some key/value is added. using [] operator.

Related with https://github.com/phpstan/phpstan/issues/11628 as array_is_list($v) should imply list and such list must maintain list behaviour when value is appended/unset to/from the end.

nielsdos commented 1 month ago

This is a behaviour change with possible BC concerns. Therefore this needs an RFC.