|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74302 yield from1251('dfd') ("from1251" is a valid function name) fails
Submitted: 2017-03-23 19:10 UTC Modified: 2017-03-23 23:49 UTC
From: xtpd17 at gmail dot com Assigned: pollita (profile)
Status: Closed Package: *General Issues
PHP Version: 7.1.3 OS: Windows 7
Private report: No CVE-ID: None
 [2017-03-23 19:10 UTC] xtpd17 at gmail dot com
Seems like parser thinks that is a "yield from generator" case, which is not.

Test script:

function from1251($a)
	return $a;

function foo()
	yield from1251('df');

// Parse error: syntax error, unexpected '(' in test.php on line 10


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-23 19:40 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pollita
 [2017-03-23 19:40 UTC]
Verified.  Fix should be simple enough.
 [2017-03-23 20:51 UTC]
-Status: Assigned +Status: Closed
 [2017-03-23 23:49 UTC]
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-24 06:56 UTC] xtpd17 at gmail dot com
> 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 )).
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Sep 27 09:01:24 2023 UTC