xref: /PHP-8.1/ext/spl/tests/bug54304.phpt (revision a92f5cbe)
1--TEST--
2Bug #54304 (Setting replacement value for RegexIterator doesn't work)
3--FILE--
4<?php
5class foo extends ArrayIterator {
6    public function __construct( ) {
7        parent::__construct(array(
8            'test3'=>'test999'));
9    }
10}
11
12$h = new foo;
13$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
14$i->replacement = "42";
15var_dump($i->replacement);
16foreach ($i as $name=>$value) {
17    var_dump($name, $value);
18}
19var_dump($i->replacement);
20?>
21--EXPECT--
22string(2) "42"
23string(5) "test3"
24string(2) "42"
25string(2) "42"
26