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.
function map_host(){ if(isset(Domain::HOST_MAPPINGS[$_SERVER['HTTP_HOST']])){ return Domain::HOST_MAPPINGS[$_SERVER['HTTP_HOST']]; }else{ return $_SERVER['HTTP_HOST']; } } class Domain{ const HOST_MAPPINGS=['www.example.com'=>'example.com']; } Line 2 in the code above is marked with the misidentified syntax error described in the title of this report: Syntax error: unexpected: '[' after: 'OR' expected: '(' There should be no syntax error warning here from NetBeans (the code runs fine in PHP7!) While Line 2 has been highlighted as a syntax error, Line 3 has not - so it only seems to happen inside isset().
Possibly related to Bug 250579. https://netbeans.org/bugzilla/show_bug.cgi?id=250579
The syntax error warning is retained even if we replace, on Line 2, $_SERVER['HTTP_HOST'], with a string, 'test'.
@junichi11: Junichi, would you like to have a look at this issue? Thanks.
(In reply to BlameFate from comment #1) > Possibly related to Bug 250579. I guess that it is not related to it (I can be wrong). Because your code is invalid in PHP5.6 or older and it works fine in PHP7. more simple examples: <?php const A = ["test"]; var_dump(isset("test"[0])); // PHP7: bool(true) , PHP5.6: Fatal Error var_dump(isset([1][0])); // PHP7: bool(true) , PHP5.6: Fatal Error var_dump(isset(A[0])); // PHP7: bool(true) , PHP5.6: Fatal Error (In reply to Tomas Mysik from comment #3) > @junichi11: Junichi, would you like to have a look at this issue? Tomas, I'll try it. Thanks.
I see, thanks Junichi for explanation.
Increasing to P2, we need to fix this since from PHP 7 constants can contain arrays so accessing their values will happen very often. Thanks.
@junichi11: Junichi, please if you start working on this issue, reassign it to yourself first. Thanks.
(In reply to Tomas Mysik from comment #7) > @junichi11: Junichi, please if you start working on this issue, reassign it > to yourself first. Thanks. I'll do it. Thanks.
(In reply to junichi11 from comment #8) > I'll do it. Thanks. Thanks a lot!
Fixed. The following case is not resolved because $object->test()() is not supported yet: isset($object->test()()[0]); http://hg.netbeans.org/web-main/rev/29c77ad37eca Thanks.
Integrated into 'main-silver', will be available in build *201605250002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/29c77ad37eca User: Junichi Yamamoto <junichi11@netbeans.org> Log: #258959 - [PHP7] Array class constant element reference within isset() marked: Syntax error: unexpected: '[' after: 'OR' expected: '('