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