1--TEST-- 2Make sure optimization does not interfere with yield by ref 3--FILE-- 4<?php 5 6function &gen() { 7 yield $v = 0; 8 yield $v = 1; 9} 10 11foreach (gen() as $v) { 12 var_dump($v); 13} 14 15?> 16--EXPECTF-- 17Notice: Only variable references should be yielded by reference in %s on line %d 18int(0) 19 20Notice: Only variable references should be yielded by reference in %s on line %d 21int(1) 22