This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243409 - PHP 5.5 foreach() with direct array and list() gives syntax error
Summary: PHP 5.5 foreach() with direct array and list() gives syntax error
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-31 13:46 UTC by Fleshgrinder
Modified: 2016-03-07 08:49 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Error in foreach with list (9.08 KB, image/png)
2016-02-29 17:16 UTC, antoniocs
Details
No foreach error (11.30 KB, image/png)
2016-02-29 17:17 UTC, antoniocs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fleshgrinder 2014-03-31 13:46:15 UTC
The following construct yields a syntax error in NetBeans but is perfectly valid PHP 5.5.

<?php

foreach ([[ "foo", "bar" ]] as list($foo, $bar)) {

}

?>
Comment 1 Vladimir Riha 2014-04-04 06:33:02 UTC
reproducible

Product Version: NetBeans IDE Dev (Build 201404040001)
Java: 1.8.0; Java HotSpot(TM) Client VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 Ondrej Brejla 2014-06-13 08:23:10 UTC
Parser needs to be improved. Thanks.
Comment 3 Ondrej Brejla 2014-07-03 11:51:08 UTC
Fixed in web-main #e71f9614c822
Comment 4 Quality Engineering 2014-07-04 02:36:57 UTC
Integrated into 'main-silver', will be available in build *201407040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e71f9614c822
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #243409 - PHP 5.5 foreach() with direct array and list() gives syntax error
#245320 - Incorrect syntax error in foreach 5.4
Comment 5 Vladimir Riha 2014-07-04 07:14:51 UTC
Verified

Product Version: NetBeans IDE Dev (Build 201407040001)
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.13.0-29-generic running on i386; UTF-8; en_US (nb)
Comment 6 Fleshgrinder 2014-07-05 08:35:32 UTC
Perfect work as always, endless thanks Ondrej.
Comment 7 antoniocs 2016-02-29 17:16:38 UTC
Created attachment 158675 [details]
Error in foreach with list
Comment 8 antoniocs 2016-02-29 17:17:37 UTC
Created attachment 158676 [details]
No foreach error
Comment 9 antoniocs 2016-02-29 17:20:30 UTC
This doesn't seem to be fixed.
I am using:

Product Version: NetBeans IDE 8.1 (Build 201510222201)
Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1
Java: 1.8.0_66; Java HotSpot(TM) 64-Bit Server VM 25.66-b18
Runtime: Java(TM) SE Runtime Environment 1.8.0_66-b18

and running php 5.6.

And I am getting a syntax error in Symfony files (which run without issue).
Here is an example: (first attached file)

 // resolve definitions
        krsort($definitions);
        foreach ($definitions as $id => list($domElement, $file, $wild)) {
<<code>>
        }

I am getting the Syntax error on the foreach line. 
If I remove the "$id =>" the syntax error goes away. (second attached file)

This code if from: vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php (there are more files with this error and also in the auto generated code from Symfony)
Comment 10 Tomas Mysik 2016-03-07 06:28:19 UTC
A bit different scenario. Please, next time report a new issue.

Thanks.
Comment 11 antoniocs 2016-03-07 08:11:32 UTC
I did.

https://netbeans.org/bugzilla/show_bug.cgi?id=258200
Comment 12 Tomas Mysik 2016-03-07 08:48:42 UTC
(In reply to antoniocs from comment #11)
> I did.
> 
> https://netbeans.org/bugzilla/show_bug.cgi?id=258200

Thanks.

Closing this issue back.