xref: /PHP-7.3/ext/spl/tests/bug54304.phpt (revision b746e698)
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--
22int(42)
23string(5) "test3"
24string(2) "42"
25int(42)
26