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 271109 - Bogus syntax error on ((string)$this->foo)[0]
Summary: Bogus syntax error on ((string)$this->foo)[0]
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: Dev
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: junichi11
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-17 15:48 UTC by kAlvaro
Modified: 2017-08-07 01:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (25.38 KB, image/png)
2017-07-31 01:08 UTC, junichi11
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kAlvaro 2017-07-17 15:48:39 UTC
Product Version = NetBeans IDE Dev (Build 201707050001)
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:

<?php

class Foo
{

	protected $status = 200;

	public function __construct()
	{
		echo ((string)$this->status)[0];
	}

}

ACTUAL:

Syntax error, unexpected [ after )

EXPECTED:

No error reported (it's valid code since PHP/7.0.0). Fiddle: https://3v4l.org/toRuh
Comment 1 junichi11 2017-07-30 02:47:35 UTC
Reproducible. Thanks for reporting it!
Comment 2 junichi11 2017-07-31 01:08:06 UTC
Created attachment 164864 [details]
screenshot
Comment 3 junichi11 2017-07-31 01:15:23 UTC
I've also fixed the missing unhandled errors:
- foo()()
- foo->bar()()
- Foo::bar()()
These are invalid in PHP5.

I'm going to push my changes tonight or tomorrow.

Thanks!
Comment 4 junichi11 2017-07-31 22:04:54 UTC
Unfortunately, web-main build fails now. I'll wait until it is fixed.

Thanks.
Comment 5 junichi11 2017-08-03 01:42:36 UTC
Fixed.

http://hg.netbeans.org/web-main/rev/ae733ed630f1

@kAlvaro
Could you verify it when it is available in a dev build[1]? (Probably, tomorrow or later)

[1] http://bits.netbeans.org/download/trunk/nightly/latest/

Thanks.
Comment 6 Quality Engineering 2017-08-04 01:47:27 UTC
Integrated into 'main-silver', will be available in build *201708040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ae733ed630f1
User: Junichi Yamamoto <junichi11@netbeans.org>
Log: #271109 - Bogus syntax error on ((string)$this->foo)[0]

Also, fix missing unhandled errors(e.g. foo()(), foo->bar()(), Foo::bar()()).
Comment 7 kAlvaro 2017-08-06 16:08:27 UTC
@junichi11 Everything looks correct here. Thank you very much.
Comment 8 junichi11 2017-08-07 01:26:19 UTC
(In reply to kAlvaro from comment #7)
> Everything looks correct here.

Thank you for your verification!