Skip to content

Commit e2e2d29

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix memory leak
2 parents 4db981b + 7ebda19 commit e2e2d29

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5732,7 +5732,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
57325732
| // if (UNEXPECTED(EG(exception) != NULL)) {
57335733
| MEM_LOAD_64_ZTS ldr, REG0, executor_globals, exception, TMP1
57345734
| cbz REG0, >8 // END OF zend_jit_assign_to_variable()
5735-
| b ->exception_handler_undef
5735+
| b ->exception_handler
57365736
} else {
57375737
| b >8
57385738
}

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6251,7 +6251,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
62516251
| // if (UNEXPECTED(EG(exception) != NULL)) {
62526252
| MEM_CMP_ZTS aword, executor_globals, exception, 0, r0
62536253
| je >8 // END OF zend_jit_assign_to_variable()
6254-
| jmp ->exception_handler_undef
6254+
| jmp ->exception_handler
62556255
} else {
62566256
| jmp >8
62576257
}

ext/opcache/tests/jit/assign_053.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
JIT ASSIGN: memory leak
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
class Test {
12+
public string $x;
13+
}
14+
$test=new Test;
15+
$test->x = " $y ";
16+
$r = &$test->x + ($r = $y);
17+
?>
18+
--EXPECTF--
19+
Warning: Undefined variable $y in %sassign_053.php on line 6
20+
21+
Warning: Undefined variable $y in %sassign_053.php on line 7
22+
23+
Fatal error: Uncaught TypeError: Cannot assign null to reference held by property Test::$x of type string in %sassign_053.php:7
24+
Stack trace:
25+
#0 {main}
26+
thrown in %sassign_053.php on line 7

0 commit comments

Comments
 (0)