eranif / codelite

A multi purpose IDE specialized in C/C++/Rust/Python/PHP and Node.js. Written in C++
https://codelite.org
GNU General Public License v2.0
2.08k stars 444 forks source link

[Bug]: Crash on anonumous classe with traits #3398

Closed AJenbo closed 1 week ago

AJenbo commented 4 weeks ago

What happened?

<?php

use Sentry\Laravel\Features\Concerns\ResolvesEventOrigin;

class Integration
{
    public static function lazyLoadingViolationReporter()
    {
        return new class() {
            use ResolvesEventOrigin;
        };
    }
}

If a function creates an anonymous class that uses a trait CodeLite will try to assign the trait to the function (lazyLoadingViolationReporter) rather then the class which causes a crash.

[08:00:10:519 DBG] [Main] Rebuilding PHP class cache...
[08:00:10:530 WRN] [Main] PHPLookupTable::RebuildClassCache: SQLITE_BUSY[5]: database is locked
[08:00:10:588 DBG] [Main] Bye
[08:00:11:005 DBG] ZombieReaperPOSIX: going down

Commenting line 1153 in PHPSourceFile.cpp out prevents the crash:

// clas->Cast<PHPEntityClass>()->SetTraits(identifiers);

image

Version

17.10.0

Operating system

Linux