mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
27 lines
583 B
PHP
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
|