Skip to content

Commit 0cf874c

Browse files
committed
Add test for string release during FETCH_DIM_IS offset warning
1 parent 587f709 commit 0cf874c

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
JIT FETCH_DIM_IS: leading-numeric string offset warning may release the string
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=function
7+
opcache.file_update_protection=0
8+
--EXTENSIONS--
9+
opcache
10+
--FILE--
11+
<?php
12+
set_error_handler(function ($errno, $errstr) {
13+
echo "Warning: $errstr\n";
14+
$GLOBALS['s'] = null;
15+
});
16+
17+
function make(int $n) {
18+
return str_repeat("abc", $n);
19+
}
20+
21+
function test() {
22+
global $s;
23+
return $s["1x"] ?? "default";
24+
}
25+
26+
$s = make(2);
27+
var_dump(test());
28+
?>
29+
--EXPECT--
30+
Warning: Illegal string offset "1x"
31+
string(7) "default"

0 commit comments

Comments
 (0)