summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Magnusson <bjori@php.net>2011-09-12 17:20:44 +0000
committerHannes Magnusson <bjori@php.net>2011-09-12 17:20:44 +0000
commit4653534643e7762d25744c7c642727fdb4b799e6 (patch)
tree97af0aedceb39005dfd55a6b04825da75e3762f9
parent3d3a6a3b965fa059f30d52f8de6f4251af887f6a (diff)
downloadphp-git-4653534643e7762d25744c7c642727fdb4b799e6.tar.gz
Test for non-string replacement, bug#54304
-rw-r--r--ext/spl/tests/bug54304.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/spl/tests/bug54304.phpt b/ext/spl/tests/bug54304.phpt
new file mode 100644
index 0000000000..32cbe486a0
--- /dev/null
+++ b/ext/spl/tests/bug54304.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #54304 (Setting replacement value for RegexIterator doesn't work)
+--FILE--
+<?php
+class foo extends ArrayIterator {
+ public function __construct( ) {
+ parent::__construct(array(
+ 'test3'=>'test999'));
+ }
+}
+
+$h = new foo;
+$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
+$i->replacement = 42;
+var_dump($i->replacement);
+foreach ($i as $name=>$value) {
+ var_dump($name, $value);
+}
+var_dump($i->replacement);
+?>
+--EXPECT--
+int(42)
+string(5) "test3"
+string(2) "42"
+int(42)
+