php / php-src

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

Appending to a list should maintain list #15966

Open mvorisek opened 9 hours ago

mvorisek commented 9 hours 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 9 hours ago

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