1--TEST--
2Bug #55871 (Interruption in substr_replace())
3--FILE--
4<?php
5class test1 {
6	public function __toString() {
7		preg_match('//', '', $GLOBALS['my_var']);
8		return '';
9	}
10}
11
12class test2 {
13        public function __toString() {
14		$GLOBALS['my_var'] += 0x08048000;
15                return '';
16        }
17}
18
19class 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);
28var_dump($out);
29$my_var = str_repeat('A', 40);
30$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
31var_dump($out);
32$my_var = str_repeat('A', 40);
33$out = substr_replace(array(&$my_var), array(new test3), 40, 0);
34var_dump($out);
35--EXPECTF--
36
37Warning: substr_replace(): Argument was modified while replacing in %s on line %d
38array(0) {
39}
40
41Warning: substr_replace(): Argument was modified while replacing in %s on line %d
42array(0) {
43}
44
45Warning: substr_replace(): Argument was modified while replacing in %s on line %d
46array(0) {
47}
48