com php-src: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally): NEWS Zend/tests /bug74840.phpt
ext/opcache/Optimizer/optimize_t emp_vars_5.c

From: Date: Sat, 01 Jul 2017 09:52:03 +0000
Subject: com php-src: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally): NEWS Zend/tests /bug74840.phpt
ext/opcache/Optimizer/optimize_t emp_vars_5.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98295@lists.php.net to get a copy of this message
Commit: e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8 Author: Bob Weinand <bobwei9@hotmail.com> Sat, 1 Jul 2017 11:52:03 +0200 Parents: 2a1ad885388d1287b7a963d5b9ca9d297163ec19 Branches: PHP-7.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8 Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally) Bugs: https://bugs.php.net/74840 Changed paths: M NEWS A Zend/tests/bug74840.phpt M ext/opcache/Optimizer/optimize_temp_vars_5.c Diff: diff --git a/NEWS b/NEWS index 28a7d29..3a97a45 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ PHP NEWS . Fixed bug #74761 (Unary operator expected error on some systems). (petk) . Fixed bug #73900 (Use After Free in unserialize() SplFixedArray). (nikic) +- Opcache: + . Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within + finally). (Bob) + - PDO: . Fixed bug #69356 (PDOStatement::debugDumpParams() truncates query). (Adam Baratz) diff --git a/Zend/tests/bug74840.phpt b/Zend/tests/bug74840.phpt new file mode 100644 index 0000000...68e27cb --- /dev/null +++ b/Zend/tests/bug74840.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #74840: Opcache overwrites argument of GENERATOR_RETURN within finally +--FILE-- +<?php + +$g = (function($a) { + try { + return $a + 1; + } finally { + $b = $a + 2; + var_dump($b); + } + yield; // Generator +})(1); +$g->next(); +var_dump($g->getReturn()); + +?> +--EXPECT-- +int(3) +int(2) diff --git a/ext/opcache/Optimizer/optimize_temp_vars_5.c b/ext/opcache/Optimizer/optimize_temp_vars_5.c index cfeb121..5cc7b79 100644 --- a/ext/opcache/Optimizer/optimize_temp_vars_5.c +++ b/ext/opcache/Optimizer/optimize_temp_vars_5.c @@ -109,6 +109,7 @@ void optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_ctx *c */ if ((op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) && (opline->opcode == ZEND_RETURN || + opline->opcode == ZEND_GENERATOR_RETURN || opline->opcode == ZEND_RETURN_BY_REF || opline->opcode == ZEND_FREE || opline->opcode == ZEND_FE_FREE)) {

« previous php.cvs (#98295) next »