Skip to content

Commit b769336

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2 parents 3eead43 + 7cf6f17 commit b769336

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ PHP NEWS
1313
. Fixed bug GH-8848 (imagecopyresized() error refers to the wrong argument).
1414
(cmb)
1515

16+
- OPcache:
17+
. Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php
18+
syntaxe of a valid file). (Dmitry)
19+
1620
07 Jul 2022, PHP 8.1.8
1721

1822
- Core:

ext/opcache/jit/zend_jit.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,22 +1672,18 @@ static void zend_jit_add_hint(zend_lifetime_interval **intervals, int dst, int s
16721672
src = dst;
16731673
dst = tmp;
16741674
}
1675-
while (1) {
1676-
if (intervals[dst]->hint) {
1677-
if (intervals[dst]->hint->range.start < intervals[src]->range.start) {
1678-
int tmp = src;
1679-
src = intervals[dst]->hint->ssa_var;
1680-
dst = tmp;
1681-
} else {
1682-
dst = intervals[dst]->hint->ssa_var;
1683-
}
1675+
while (dst != src && intervals[dst]->hint) {
1676+
if (intervals[dst]->hint->range.start < intervals[src]->range.start) {
1677+
int tmp = src;
1678+
src = intervals[dst]->hint->ssa_var;
1679+
dst = tmp;
16841680
} else {
1685-
if (dst != src) {
1686-
intervals[dst]->hint = intervals[src];
1687-
}
1688-
return;
1681+
dst = intervals[dst]->hint->ssa_var;
16891682
}
16901683
}
1684+
if (dst == src) {
1685+
intervals[dst]->hint = intervals[src];
1686+
}
16911687
}
16921688

16931689
/* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and

ext/opcache/tests/jit/gh8847.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Bug GH-8847: PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
class klass
11+
{
12+
public function method(int $int, bool $bool=false) : int
13+
{
14+
while($int >= 0 && !$function1)
15+
$int--;
16+
if($bool)
17+
while($int >= 0 && $function1)
18+
$int--;
19+
return $int;
20+
}
21+
}
22+
?>
23+
DONE
24+
--EXPECTF--
25+
DONE

0 commit comments

Comments
 (0)