Skip to content

Commit 02acc5a

Browse files
committed
Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
1 parent bd2cd26 commit 02acc5a

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PHP NEWS
1919
. Fixed bug #81206 (Multiple PHP processes crash with JIT enabled). (cmb,
2020
Nikita)
2121
. Fixed bug #81272 (Segfault in var[] after array_slice with JIT). (Nikita)
22+
. Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT). (Dmitry)
2223

2324
- Standard:
2425
. Fixed bug #72146 (Integer overflow on substr_replace). (cmb)

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13610,7 +13610,7 @@ static int zend_jit_assign_obj_op(dasm_State **Dst,
1361013610
}
1361113611
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1361213612
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
13613-
| jmp >8
13613+
| jmp >7
1361413614
} else {
1361513615
| jmp ->exception_handler
1361613616
}
@@ -14029,7 +14029,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1402914029

1403014030
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1403114031
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
14032-
| jmp >8
14032+
| jmp >7
1403314033
} else {
1403414034
| jmp >9
1403514035
}
@@ -14159,7 +14159,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1415914159
val_info |= MAY_BE_RC1|MAY_BE_RCN;
1416014160
}
1416114161

14162-
|8:
14162+
|7:
1416314163
| // FREE_OP_DATA();
1416414164
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline
1416514165
| jmp >9

ext/opcache/tests/jit/bug81255.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
Bug #81255: Memory leak in PHPUnit with functional JIT
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit_buffer_size=1M
7+
opcache.jit=function
8+
--SKIPIF--
9+
<?php require_once('skipif.inc'); ?>
10+
--FILE--
11+
<?php
12+
eval('class B {}');
13+
class A extends B {
14+
private ?string $x = null;
15+
16+
public function foo($a) {
17+
if (!($this->x = str_repeat($a, 5))) {
18+
throw new Exception('ops');
19+
}
20+
var_dump($this->x);
21+
$this->x = null;
22+
}
23+
}
24+
25+
$a = new A;
26+
$a->foo('a');
27+
$a->foo('b');
28+
?>
29+
--EXPECT--
30+
string(5) "aaaaa"
31+
string(5) "bbbbb"

0 commit comments

Comments
 (0)