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 236009 - the support in "Const array/string dereference" is not implemented good.
Summary: the support in "Const array/string dereference" is not implemented good.
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 07:02 UTC by nadavvin
Modified: 2013-09-20 18:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nadavvin 2013-09-16 07:02:15 UTC
the support in "Const array/string dereference":
https://wiki.php.net/rfc/constdereference

is not implemented good.

while this is valid in netbeans:

echo array(2,3)[1];

this isn't:

function a(){
	return array(3,4);
}
echo a()[0];
Comment 1 Ondrej Brejla 2013-09-16 07:43:43 UTC
Not sure if it should work. Documentation [1] just talks about "array and string literals". Function dereferencing is not mentioned anywhere (or at least I didn't saw it anywhere...it's not in RFC [2] either, there are just literals too).

[1] http://www.php.net/manual/en/migration55.new-features.php
[2] https://wiki.php.net/rfc/constdereference

So incomplete for now...I'll try to find some more info.
Comment 2 nadavvin 2013-09-16 08:41:13 UTC
It should work since it's work.

php 5.5 run it without any warnings:

php > function a(){return [3,4];}
php > echo a()[1]
php > ;
4
Comment 3 nadavvin 2013-09-16 08:46:19 UTC
Official example:

http://il1.php.net/manual/en/language.types.array.php

Example #7 Array dereferencing
<?php
function getArray() {
    return array(1, 2, 3);
}

// on PHP 5.4
$secondElement = getArray()[1];
Comment 4 Ondrej Brejla 2013-09-16 08:47:38 UTC
Ok, I just tested that in NB and just "Language feature not compatible..." error occurs, so it's supported (it means it's parsed correctly), but wrong hint is used for PHP 5.5 project type. I'll look at it.
Comment 5 Ondrej Brejla 2013-09-16 08:55:11 UTC
Fixed in web-main #ddbf4ce0d620
Comment 6 Quality Engineering 2013-09-17 02:01:21 UTC
Integrated into 'main-silver', will be available in build *201309170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ddbf4ce0d620
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #236009 - the support in "Const array/string dereference" is not implemented good.
Comment 7 mmolda 2013-09-20 18:53:08 UTC
Verified. Thanks.

Product Version: NetBeans IDE Dev (Build 201309191137)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)