1--TEST-- 2Bug #70868, with PCRE JIT 3--INI-- 4pcre.jit=1 5--SKIPIF-- 6<?php if (!extension_loaded("pcre")) die("skip"); ?> 7--FILE-- 8<?php 9 10namespace X; 11 12$iterator = 13 new \RegexIterator( 14 new \ArrayIterator(['A.phpt', 'B.phpt', 'C.phpt']), 15 '/\.phpt$/' 16 ) 17; 18 19foreach ($iterator as $foo) { 20 var_dump($foo); 21 preg_replace('/\.phpt$/', '', ''); 22} 23 24echo "Done", PHP_EOL; 25 26?> 27--EXPECTF-- 28 29string(6) "A.phpt" 30string(6) "B.phpt" 31string(6) "C.phpt" 32Done 33