Summary
array_fill_keys() with a nested array as a key element must emit Zend's E_WARNING: Array to string conversion and use the string key "Array". VM throws Error: Object of class array could not be converted to string (wrong exception class/message).
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_gap_array_fill_keys_array_key.php
php bin/vm.php test/repro/maintainer_gap_array_fill_keys_array_key.php'
| Call |
Zend PHP 8.2 |
VM today |
array_fill_keys([[[1]]], 1) |
warning + array('Array' => 1) |
Error ❌ |
php-src reference
Implementation (PHP-in-PHP)
ext/standard/VmArray.php — array key coercion: warn via frame helper, use literal "Array" key (same as ext/standard/array_combine / php-src _array_to_string)
- Do not route through object
__toString path
Done when (php-src-strict)
Verification
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_array_fill_keys_array_key.php
Related: #8779, #1492
Summary
array_fill_keys()with a nested array as a key element must emit Zend'sE_WARNING: Array to string conversionand use the string key"Array". VM throwsError: Object of class array could not be converted to string(wrong exception class/message).Repro
array_fill_keys([[[1]]], 1)array('Array' => 1)php-src reference
ext/standard/array.c—php_array_fill_keys,_zval_get_string_funcarray branchImplementation (PHP-in-PHP)
ext/standard/VmArray.php— array key coercion: warn via frame helper, use literal"Array"key (same asext/standard/array_combine/ php-src_array_to_string)__toStringpathDone when (php-src-strict)
array('Array' => 1)on VMVerification
Related: #8779, #1492