1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
Gina Peter Banyard 9a1b8a785d Fix GH-20194: null offset deprecation not emitted for writes (#20238)
Based on a patch from @ndossche
2025-10-29 18:36:10 +00:00

27 lines
583 B
PHP

--TEST--
Tests iterator_to_array() with non-scalar keys
--FILE--
<?php
function gen() {
yield "foo" => 0;
yield 1 => 1;
yield 2.5 => 2;
yield null => 3;
yield [] => 4;
yield new stdClass => 5;
}
try {
var_dump(iterator_to_array(gen()));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Cannot access offset of type array on array