Skip to content

Commit 4cf7a25

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
2 parents fda0ed5 + 02acc5a commit 4cf7a25

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.1.0beta2
44

5-
5+
- Opcache:
6+
. Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
67

78
22 Jul 2021, PHP 8.1.0beta1
89

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12843,7 +12843,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1284312843
}
1284412844
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1284512845
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
12846-
| b >8
12846+
| b >7
1284712847
} else {
1284812848
| b ->exception_handler
1284912849
}
@@ -12918,7 +12918,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1291812918

1291912919
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1292012920
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
12921-
| b >8
12921+
| b >7
1292212922
} else {
1292312923
| b >9
1292412924
}
@@ -13011,7 +13011,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1301113011
val_info |= MAY_BE_RC1|MAY_BE_RCN;
1301213012
}
1301313013

13014-
|8:
13014+
|7:
1301513015
| // FREE_OP_DATA();
1301613016
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline, ZREG_TMP1, ZREG_TMP2
1301713017
| b >9

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13280,7 +13280,7 @@ static int zend_jit_assign_obj_op(dasm_State **Dst,
1328013280
}
1328113281
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1328213282
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
13283-
| jmp >8
13283+
| jmp >7
1328413284
} else {
1328513285
| jmp ->exception_handler
1328613286
}
@@ -13699,7 +13699,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1369913699

1370013700
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1370113701
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
13702-
| jmp >8
13702+
| jmp >7
1370313703
} else {
1370413704
| jmp >9
1370513705
}
@@ -13829,7 +13829,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1382913829
val_info |= MAY_BE_RC1|MAY_BE_RCN;
1383013830
}
1383113831

13832-
|8:
13832+
|7:
1383313833
| // FREE_OP_DATA();
1383413834
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline
1383513835
| 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)