php-src/Zend/tests/iterator_key_by_ref.phpt
Nikita Popov 46f9fed0d8 Handle ref return from Iterator::key()
Handle this in the implementation of get_current_key of user_it,
so that the callers may assume that the key is not a reference.

Fixes oss-fuzz #33018.
2021-04-15 13:05:48 +02:00

16 lines
222 B
PHP

--TEST--
Iterator::key() with by-ref return
--FILE--
<?php
class Test extends ArrayIterator {
function &key() {
return $foo;
}
}
foreach (new Test([0]) as $k => $v) {
var_dump($k);
}
?>
--EXPECT--
NULL