php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74840 Opcache overwrites argument of GENERATOR_RETURN within finally
Submitted: 2017-07-01 09:41 UTC Modified: 2017-07-01 09:41 UTC
From: bwoebi@php.net Assigned: bwoebi (profile)
Status: Closed Package: opcache
PHP Version: master-Git-2017-07-01 (Git) OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bwoebi@php.net
New email:
PHP Version: OS:

 

 [2017-07-01 09:41 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-01 09:41 UTC] bwoebi@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bwoebi
 [2017-07-01 09:52 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 [2017-07-01 09:52 UTC] bwoebi@php.net
-Status: Assigned +Status: Closed
 [2017-07-01 09:52 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 [2017-07-01 09:53 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3cc15daf2abc1b4886d4888c3bf5ca9cef035c8
Log: Fixed bug #74840 (Opcache overwrites argument of GENERATOR_RETURN within finally)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC