mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

For by-ref generators, these may have different behavior. Fixes oss-fuzz 6059739298004992.
21 lines
379 B
PHP
21 lines
379 B
PHP
--TEST--
|
|
Make sure optimization does not interfere with yield by ref
|
|
--FILE--
|
|
<?php
|
|
|
|
function &gen() {
|
|
yield $v = 0;
|
|
yield $v = 1;
|
|
}
|
|
|
|
foreach (gen() as $v) {
|
|
var_dump($v);
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Notice: Only variable references should be yielded by reference in %s on line %d
|
|
int(0)
|
|
|
|
Notice: Only variable references should be yielded by reference in %s on line %d
|
|
int(1)
|