Bug #74302 [Com]: yield from1251('dfd') ("from1251" is a valid function name) fails
[email protected] ("xtpd17 at gmail dot com")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=74302&edit=1
ID: 74302
Comment by: xtpd17 at gmail dot com
Reported by: xtpd17 at gmail dot com
Summary: yield from1251('dfd') ("from1251" is a valid
function name) fails
Status: Closed
Type: Bug
Package: *General Issues
Operating System: Windows 7
PHP Version: 7.1.3
Assigned To: pollita
Block user comment: N
Private report: N
New Comment:
> btw, just for the record, you can work around this bug
Yep, thanks, that was the way I fixed it at first almost automatically and calmed down ("well, it's just my migration from 5.6 and new stricter parenthesis rules in 7.1"), but it looked strange enough to dig into it a bit just out of curiosity )).
Previous Comments:
------------------------------------------------------------------------
[2017-03-23 23:49:06] [email protected]
btw, just for the record, you can work around this bug for now with the following:
yield (from1251('df'));
The extra parenthesis doesn't change the meaning, but it does force the lexer to not consume the "from" portion of the function name.
------------------------------------------------------------------------
[2017-03-23 20:51:10] [email protected]
https://github.com/php/php-src/commit/0fb640c71763ddb1b8017c87cec10fc76764feff
------------------------------------------------------------------------
[2017-03-23 19:40:48] [email protected]
Verified. Fix should be simple enough.
------------------------------------------------------------------------
[2017-03-23 19:10:54] xtpd17 at gmail dot com
Description:
------------
Seems like parser thinks that is a "yield from generator" case, which is not.
Test script:
---------------
<?php
function from1251($a)
{
return $a;
}
function foo()
{
yield from1251('df');
}
// Parse error: syntax error, unexpected '(' in test.php on line 10
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74302&edit=1