]> granicus.if.org Git - php/commit
Fix bug where `yield from` is captured too greedily
authorSara Golemon <pollita@php.net>
Thu, 23 Mar 2017 19:27:33 +0000 (12:27 -0700)
committerSara Golemon <pollita@php.net>
Thu, 23 Mar 2017 20:31:06 +0000 (13:31 -0700)
commit0fb640c71763ddb1b8017c87cec10fc76764feff
tree1e9245d9f854b1be2afaae6fb3270955780fe0fa
parent1517fdb36cc125ffedd52e6e00cd3bb1adefd210
Fix bug where `yield from` is captured too greedily

In the following piece of code:

```php
function from1234($x) {
  return $x;
}
function foo($x) {
  yield from1234($x);
}
```

The statement inside foo is taken as `yield from` `1234($x)`
which is neither the intent, nor even legal syntax for an fcall.

Do a lookahead for breaking non-label characters after the
`yield from` and only accept it if they occur.
NEWS
Zend/tests/generators/yield_from_greedy_parse.phpt [new file with mode: 0644]
Zend/zend_language_scanner.l