Annotation of embedaddon/php/ext/pcre/tests/bug37800.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #37800 (preg_replace() limit parameter odd behaviour)
3: --FILE--
4: <?php
5: $s_string = '1111111111';
6: $s_search = '/1/';
7: $s_replace = 'One ';
8: $i_limit = 1;
9: $i_count = 0;
10:
11: $s_output = preg_replace($s_search, $s_replace, $s_string, $i_limit,
12: $i_count);
13: echo "Output = " . var_export($s_output, True) . "\n";
14: echo "Count = $i_count\n";
15: var_dump(preg_last_error() === PREG_NO_ERROR);
16:
17: $i_limit = strlen($s_string);
18: $s_output = preg_replace($s_search, $s_replace, $s_string, $i_limit,
19: $i_count);
20: echo "Output = " . var_export($s_output, True) . "\n";
21: echo "Count = $i_count\n";
22: var_dump(preg_last_error() === PREG_NO_ERROR);
23:
24: ?>
25: --EXPECT--
26: Output = 'One 111111111'
27: Count = 1
28: bool(true)
29: Output = 'One One One One One One One One One One '
30: Count = 10
31: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>