Skip to content

Commit 67cf04f

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Mitigation for bug #81096
2 parents 902ec69 + 3f4bc94 commit 67cf04f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ext/opcache/Optimizer/sccp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,13 +2148,16 @@ static zval *value_from_type_and_range(sccp_ctx *ctx, int var_num, zval *tmp) {
21482148
return tmp;
21492149
}
21502150

2151+
#if 0
2152+
/* Disabled due to bug #81096. */
21512153
if (!(info->type & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))
21522154
&& info->has_range
21532155
&& !info->range.overflow && !info->range.underflow
21542156
&& info->range.min == info->range.max) {
21552157
ZVAL_LONG(tmp, info->range.min);
21562158
return tmp;
21572159
}
2160+
#endif
21582161

21592162
return NULL;
21602163
}

ext/opcache/tests/ref_range_1.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Range info for references (1)
3+
--FILE--
4+
<?php
5+
6+
function test() {
7+
escape_x($x);
8+
$x = 0;
9+
modify_x();
10+
return (int) $x;
11+
}
12+
13+
function escape_x(&$x) {
14+
$GLOBALS['x'] =& $x;
15+
}
16+
17+
function modify_x() {
18+
$GLOBALS['x']++;
19+
}
20+
21+
var_dump(test());
22+
23+
?>
24+
--EXPECT--
25+
int(1)

0 commit comments

Comments
 (0)