1--TEST-- 2Tests iterator_to_array() with non-scalar keys 3--FILE-- 4<?php 5 6function gen() { 7 yield "foo" => 0; 8 yield 1 => 1; 9 yield 2.5 => 2; 10 yield null => 3; 11 yield [] => 4; 12 yield new stdClass => 5; 13} 14 15var_dump(iterator_to_array(gen())); 16 17?> 18--EXPECTF-- 19Warning: Illegal offset type in %s on line %d 20 21Warning: Illegal offset type in %s on line %d 22array(4) { 23 ["foo"]=> 24 int(0) 25 [1]=> 26 int(1) 27 [2]=> 28 int(2) 29 [""]=> 30 int(3) 31} 32