Annotation of embedaddon/php/ext/standard/tests/strings/bug55871.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #55871 (Interruption in substr_replace())
3: --FILE--
4: <?php
5: class test1 {
6: public function __toString() {
7: preg_match('//', '', $GLOBALS['my_var']);
8: return '';
9: }
10: }
11:
12: class test2 {
13: public function __toString() {
14: $GLOBALS['my_var'] += 0x08048000;
15: return '';
16: }
17: }
18:
19: class test3 {
20: public function __toString() {
21: $GLOBALS['my_var'] .= "AAAAAAAA";
22: return '';
23: }
24: }
25:
26: $my_var = str_repeat('A', 40);
27: $out = substr_replace(array(&$my_var), array(new test1), 40, 0);
28: var_dump($out);
29: $my_var = str_repeat('A', 40);
30: $out = substr_replace(array(&$my_var), array(new test2), 40, 0);
31: var_dump($out);
32: $my_var = str_repeat('A', 40);
33: $out = substr_replace(array(&$my_var), array(new test3), 40, 0);
34: var_dump($out);
35: --EXPECTF--
36:
37: Warning: substr_replace(): Argument was modified while replacing in %s on line %d
38: array(0) {
39: }
40:
41: Warning: substr_replace(): Argument was modified while replacing in %s on line %d
42: array(0) {
43: }
44:
45: Warning: substr_replace(): Argument was modified while replacing in %s on line %d
46: array(0) {
47: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>