Skip to content

Commit 7ebda19

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix memory leak
2 parents 93fc88e + 3a8912f commit 7ebda19

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
@@ -5737,7 +5737,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
57375737
| // if (UNEXPECTED(EG(exception) != NULL)) {
57385738
| MEM_LOAD_64_ZTS ldr, REG0, executor_globals, exception, TMP1
57395739
| cbz REG0, >8 // END OF zend_jit_assign_to_variable()
5740-
| b ->exception_handler_undef
5740+
| b ->exception_handler
57415741
} else {
57425742
| b >8
57435743
}

ext/opcache/jit/zend_jit_x86.dasc

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

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)