xref: /PHP-8.3/ext/spl/tests/bug68128-USE_KEY.phpt (revision 4397306b)
1--TEST--
2Bug #68128 - RecursiveRegexIterator raises "Array to string conversion" notice
3--FILE--
4<?php
5
6$arrayIterator = new ArrayIterator(array('key 1' => 'value 1', 'key 2' => ['value 2']));
7$regexIterator = new RegexIterator($arrayIterator, '/^key/', RegexIterator::MATCH, RegexIterator::USE_KEY);
8
9foreach ($regexIterator as $key => $value) {
10    var_dump($key, $value);
11}
12
13?>
14--EXPECT--
15string(5) "key 1"
16string(7) "value 1"
17string(5) "key 2"
18array(1) {
19  [0]=>
20  string(7) "value 2"
21}
22