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 271856 - Wrong PHP syntax check for PHP foreach as list
Summary: Wrong PHP syntax check for PHP foreach as list
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-28 07:29 UTC by kyborek
Modified: 2017-11-28 07:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (48.75 KB, text/plain)
2017-11-28 07:29 UTC, kyborek
Details
Screenshot of the actual problem (27.32 KB, image/png)
2017-11-28 07:33 UTC, kyborek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kyborek 2017-11-28 07:29:18 UTC
Product Version = NetBeans IDE 8.2 (Build 201705191307)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_101
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.101-b13

Reproducibility: Happens every time

STEPS:
  * Create a PHP function
  * Inside the function use code with 'foreach as list' like below
  * Turn on error checking for uninitialized variables if not enabled

CODE:
function foo($array){
 foreach ($array as list($first,$second)){
  echo $first." ".$second;//this is the problematic line of code
 }
}

ACTUAL:
  IDE shows warning stating that $first is an uninitialized variable

EXPECTED:
  No error regarding $first or $second variable as both were initialized in the 'list' statement
Comment 1 kyborek 2017-11-28 07:29:24 UTC
Created attachment 165507 [details]
IDE log
Comment 2 kyborek 2017-11-28 07:33:46 UTC
Created attachment 165508 [details]
Screenshot of the actual problem