mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
php_pcre_replace_impl() can fail and return NULL. We should take that error condition into account. Because other failures return false, we return false here as well. At first, I also thought there was a potential memory leak in the error check of replacement_str, but found that the error condition can never trigger, so replace that with an assertion. Closes GH-14292.
17 lines
339 B
PHP
17 lines
339 B
PHP
--TEST--
|
|
GH-14290 (Member access within null pointer in extension spl)
|
|
--INI--
|
|
pcre.backtrack_limit=2
|
|
pcre.jit=0
|
|
--FILE--
|
|
<?php
|
|
$h = new ArrayIterator(['test' => 'test1']);
|
|
$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
|
|
foreach ($i as $name => $value) {
|
|
var_dump($name, $value);
|
|
}
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECT--
|
|
Done
|