PHP :: Bug #74302 :: yield from1251('dfd') ("from1251" is a valid function name) fails
php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xtpd17 at gmail dot com
New email:
PHP Version: OS:

 

 [2017-03-23 19:10 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-23 19:40 UTC] pollita@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pollita
 [2017-03-23 19:40 UTC] pollita@php.net
Verified.  Fix should be simple enough.
 [2017-03-23 20:51 UTC] pollita@php.net
-Status: Assigned +Status: Closed
 [2017-03-23 23:49 UTC] pollita@php.net
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-2018 The PHP Group
All rights reserved.
Last updated: Fri Aug 17 03:01:24 2018 UTC