diff options
author | Zoe Slattery <zoe@php.net> | 2009-03-03 10:53:44 +0000 |
---|---|---|
committer | Zoe Slattery <zoe@php.net> | 2009-03-03 10:53:44 +0000 |
commit | 2c7d95c5a6a0991d935f2cb128e3d84b80c10686 (patch) | |
tree | b76c95629ed0b06028ac9b736b49628b691484c4 /run-tests.php | |
parent | 7834afebdecdf939266c02edd68ed7d11129c848 (diff) | |
download | php-git-2c7d95c5a6a0991d935f2cb128e3d84b80c10686.tar.gz |
Added %r section
Diffstat (limited to 'run-tests.php')
-rwxr-xr-x | run-tests.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/run-tests.php b/run-tests.php index 8753f6e828..004d10d397 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1737,7 +1737,33 @@ COMMAND $cmd $wanted_re = preg_replace('/\r\n/', "\n", $wanted); if (isset($section_text['EXPECTF'])) { - $wanted_re = preg_quote($wanted_re, '/'); + + // do preg_quote, but miss out any %r delimited sections + $temp = ""; + $r = "%r"; + $startOffset = 0; + $length = strlen($wanted_re); + while($startOffset < $length) { + $start = strpos($wanted_re, $r, $startOffset); + if ($start !== false) { + // we have found a start tag + $end = strpos($wanted_re, $r, $start+2); + if ($end === false) { + // unbalanced tag, ignore it. + $end = $start = $length; + } + } else { + // no more %r sections + $start = $end = $length; + } + // quote a non re portion of the string + $temp = $temp . preg_quote(substr($wanted_re, $startOffset, ($start - $startOffset)), '/'); + // add the re unquoted. + $temp = $temp . substr($wanted_re, $start+2, ($end - $start-2)); + $startOffset = $end + 2; + } + $wanted_re = $temp; + $wanted_re = str_replace( array('%binary_string_optional%'), version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? 'string' : 'binary string', |