Bug #69419 [NEW]: Returning compatible sub generator produces a warning

From: Date: Fri, 10 Apr 2015 13:02:38 +0000
Subject: Bug #69419 [NEW]: Returning compatible sub generator produces a warning
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191935@lists.php.net to get a copy of this message
From: elliotlevin at hotmail dot com Operating system: PHP version: master-Git-2015-04-10 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Returning compatible sub generator produces a warning Description: ------------ When generators were implemented, a generator function could return another generator even if it was a return by reference generator. In PHP7 this now produces a warning because it is not a variable. See http://3v4l.org/sFR11#vphp7@20141101 Test script: --------------- <?php function & genRefInner() { $var = 1; yield $var; } function & genRefOuter() { return genRefInner(); } foreach(genRefOuter() as $i) { var_dump($i); } ?> Expected result: ---------------- int(1) Actual result: -------------- Notice: Only variable references should be returned by reference in /in/sFR11 on line 9 int(1) -- Edit bug report at https://bugs.php.net/bug.php?id=69419&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69419&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69419&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69419&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69419&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69419&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69419&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69419&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69419&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69419&r=support Expected behavior: https://bugs.php.net/fix.php?id=69419&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69419&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69419&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69419&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69419&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69419&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69419&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69419&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69419&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69419&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69419&r=mysqlcfg

« previous php.bugs (#191935) next »