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 258896 - [PHP7] java.lang.AssertionError
Summary: [PHP7] java.lang.AssertionError
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: All All
: P4 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 258971 258991 260934 262156 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-04-19 05:52 UTC by junichi11
Modified: 2016-05-20 05:29 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stacktrace (4.29 KB, text/plain)
2016-04-19 05:52 UTC, junichi11
Details

Note You need to log in before you can comment on or make changes to this bug.
Description junichi11 2016-04-19 05:52:11 UTC
Created attachment 159309 [details]
stacktrace

Reproducible code:

<?php

class Foo {
    /**
     *
     * @var Bar 
     */
    public static $bar;
    function __construct()
    {
        self::$bar = new Bar(); 
    }
}

class Bar {
    /**
     *
     * @var Baz
     */
    public static $baz;

    function __construct()
    {
        self::$baz = new Baz(); 
    }
}

class Baz {
    /**
     *
     * @var Qux
     */
    public static $qux;
    function __construct()
    {
        self::$qux = new Qux(); 
    }
}

class Qux {
    public static $test = "test";
    function __construct()
    {
    }
    public function test() {
        echo "test";
    }
}

$foo = new Foo();
echo $foo::$bar::$baz::$qux::$test;
$foo::$bar::$baz::$qux->test();

Thanks.
Comment 1 Tomas Mysik 2016-05-02 07:19:07 UTC
Taking over. Thanks.
Comment 2 Tomas Mysik 2016-05-09 06:15:15 UTC
Hmm, this is complicated - the last lines are marked by NetBeans PHP parser as syntax errors even if they are valid in PHP 7. The cause is that the grammar of the NB parser cannot be easily updated for "$a::$b::$c" cases (reduce/reduce error). I plan to have a look at it later but still hope that it will not be a major problem because instead of using:

echo $foo::$bar::$baz::$qux::$test;

one could (should? would?) use:

echo Qux::$test;

which makes better sense to me.

Lowering to P4, in FCS builds assertions are not enabled so no error will occur.

Thanks for reporting.
Comment 3 junichi11 2016-05-09 10:08:29 UTC
I see. This code does not mean much :) I just wanted to confirm whether "$a::$b::$c" can be used actually.

Thanks!
Comment 4 Tomas Mysik 2016-05-13 06:42:40 UTC
I have removed the assertions, it can easily happen that NB is not able to resolve types correctly (missing files, typos etc.).

Thanks.

http://hg.netbeans.org/web-main/rev/09c1daf09765
Comment 5 Tomas Mysik 2016-05-19 05:51:09 UTC
*** Bug 260934 has been marked as a duplicate of this bug. ***
Comment 6 Tomas Mysik 2016-05-19 05:51:27 UTC
*** Bug 258991 has been marked as a duplicate of this bug. ***
Comment 7 Tomas Mysik 2016-05-19 05:52:12 UTC
*** Bug 258971 has been marked as a duplicate of this bug. ***
Comment 8 Tomas Mysik 2016-05-20 05:29:10 UTC
*** Bug 262156 has been marked as a duplicate of this bug. ***