Skip to content

Commit ee17296

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix memory leak
2 parents d9cca44 + 229e80c commit ee17296

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Zend/Optimizer/block_pass.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
300300
src->opcode != ZEND_FETCH_STATIC_PROP_R &&
301301
src->opcode != ZEND_FETCH_DIM_R &&
302302
src->opcode != ZEND_FETCH_OBJ_R &&
303-
src->opcode != ZEND_NEW) {
303+
src->opcode != ZEND_NEW &&
304+
src->opcode != ZEND_FETCH_THIS) {
304305
src->result_type = IS_UNUSED;
305306
MAKE_NOP(opline);
306307
++(*opt_count);

ext/opcache/tests/opt/inline_001.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Fuction inlining 001: FETCH_THIS is incompatible with unused result
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
class Foo {
10+
function __construct() {
11+
Some::foo($this);
12+
}
13+
}
14+
class Some {
15+
static function foo() {
16+
}
17+
}
18+
new Foo;
19+
?>
20+
DONE
21+
--EXPECT--
22+
DONE

0 commit comments

Comments
 (0)