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 179351 - Context violation allowed in editor
Summary: Context violation allowed in editor
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2010-01-10 04:19 UTC by hamdik
Modified: 2016-09-22 03:30 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description hamdik 2010-01-10 04:19:16 UTC
Although using $this keyword in non-object context causes fatal error in PHP, NetBeans PHP Editor allows to use it. It should be fixed
Comment 1 rmatous 2010-01-11 02:35:04 UTC
Please, more details, the best is an piece of php code with description, thanks
Comment 2 hamdik 2010-01-19 02:43:22 UTC
Here is my example code. Take a look at comments

class exampleClass
    function __construct() {
        echo 'hi!';

    public function exampleFunction() {
        return 'hi!';

    static function exampleStaticFunction()
        // NetBeans allows to write following line in this method
        $text = $this->exampleFunction();

        // Since exampleStaticFunction() is static a static function it cannot access object context. This code produces fatal error in apache. It should also give error in NetBeans

Comment 3 Filip Zamboj 2010-01-25 07:55:20 UTC
hmmm .. well, reporter is right, this could be underlined. Hint would be fine as well. I think it's enhancement not defect because it has never been implemented.
Comment 4 Filip Zamboj 2010-09-15 12:30:41 UTC
batch reassigning
Comment 5 amobilia 2016-09-22 03:30:01 UTC
Reproductible in 8.2rc / Dev 201609210002