Skip to content

Commit 2198493

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fix memory leak
2 parents 83ab9cf + 7051dc3 commit 2198493

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,10 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
922922
ZVAL_NULL(EX_VAR(opline->result.var));
923923
}
924924
}
925+
if (opline->opcode == ZEND_ASSIGN_DIM
926+
&& ((opline+1)->op1_type & (IS_VAR | IS_TMP_VAR))) {
927+
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
928+
}
925929
return NULL;
926930
}
927931
ZEND_FALLTHROUGH;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 014
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+
set_error_handler(function($code, $err) {
11+
echo "Error: $err\n";
12+
$GLOBALS['a'] = null;
13+
});
14+
$a[$y] = function(){};
15+
?>
16+
DONE
17+
--EXPECT--
18+
Error: Undefined variable $y
19+
DONE

0 commit comments

Comments
 (0)