1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/Zend/tests/generators/yield_by_reference_optimization.phpt
Nikita Popov 9ebe8494b8 Don't replace tmp with cv in YIELD argument
For by-ref generators, these may have different behavior.

Fixes oss-fuzz 6059739298004992.
2021-10-12 14:26:53 +02:00

22 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)