1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 22:22:18 +02:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix memory leak in SCCP
This commit is contained in:
Dmitry Stogov
2021-12-24 13:11:09 +03:00
2 changed files with 18 additions and 0 deletions

View File

@@ -1471,6 +1471,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
if (opline->opcode == ZEND_PRE_INC_OBJ
|| opline->opcode == ZEND_PRE_DEC_OBJ) {
SET_RESULT(result, &tmp2);
zval_ptr_dtor_nogc(&tmp1);
} else {
SET_RESULT(result, &tmp1);
}

View File

@@ -0,0 +1,17 @@
--TEST--
SCCP 035: memory leak
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--FILE--
<?php
function test() {
$obj = new stdClass;
$obj->$b = ~$b = $a='';
$obj->$a--;
}
?>
DONE
--EXPECT--
DONE