Bug #74840 [NEW]: Opcache overwrites argument of GENERATOR_RETURN within finally
| From: | bwoebi@php.net | Date: | Sat, 01 Jul 2017 09:41:48 +0000 |
| Subject: | Bug #74840 [NEW]: Opcache overwrites argument of GENERATOR_RETURN within finally | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209757@lists.php.net to get a copy of this message | ||
From: bwoebi
Operating system: Irrelevant
PHP version: master-Git-2017-07-01 (Git)
Package: opcache
Bug Type: Bug
Bug description:Opcache overwrites argument of GENERATOR_RETURN within finally
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 bug report at https://bugs.php.net/bug.php?id=74840&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74840&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74840&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74840&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74840&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74840&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74840&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74840&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74840&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74840&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74840&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74840&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74840&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74840&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74840&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74840&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74840&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74840&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74840&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74840&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74840&r=mysqlcfg