Browse Source

MFH

PHP-5.2.1RC1
Antony Dovgal 18 years ago
parent
commit
f67c0222fe
  1. 5
      ext/pcre/php_pcre.c
  2. 22
      ext/pcre/tests/006.phpt

5
ext/pcre/php_pcre.c

@ -1220,8 +1220,11 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
efree(subject_value);
subject_value = result;
subject_len = *result_len;
} else {
efree(subject_value);
return NULL;
}
zend_hash_move_forward(Z_ARRVAL_P(regex));
}

22
ext/pcre/tests/006.phpt

@ -0,0 +1,22 @@
--TEST--
preg_replace() with array of failing regular expressions
--FILE--
<?php
$text = '[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]';
$result = preg_replace(array('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU'), '', $text);
var_dump($text);
var_dump($result);
$result = preg_replace('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '', $text);
var_dump($text);
var_dump($result);
echo "Done\n";
?>
--EXPECTF--
string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
NULL
string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
NULL
Done
Loading…
Cancel
Save