Bug #74840 [Opn->Asn]: Opcache overwrites argument of GENERATOR_RETURN within finally

From: Date: Sat, 01 Jul 2017 09:41:59 +0000
Subject: Bug #74840 [Opn->Asn]: Opcache overwrites argument of GENERATOR_RETURN within finally
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209758@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74840&edit=1 ID: 74840 Updated by: bwoebi@php.net Reported by: bwoebi@php.net Summary: Opcache overwrites argument of GENERATOR_RETURN within finally -Status: Open +Status: Assigned Type: Bug Package: opcache Operating System: Irrelevant PHP Version: master-Git-2017-07-01 (Git) -Assigned To: +Assigned To: bwoebi Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2017-07-01 09:41:42] bwoebi@php.net Description: ------------ Within generators, the temporary argument of GENERATOR_RETURN is ignored while reindexing temporaries in a finally block. This leads to illegal reuse of a still live temporary and will leak/doubly use the temporary value returned by the generator. Test script: --------------- <?php $g = (function($a) { try { return $a + 1; } finally { $b = $a + 2; var_dump($b); } yield; // Generator })(1); $g->next(); var_dump($g->getReturn()); Expected result: ---------------- int(3) int(2) Actual result: -------------- int(3) int(3) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74840&edit=1

« previous php.bugs (#209758) next »