goaop / framework

:gem: Go! AOP PHP - modern aspect-oriented framework for the new level of software development
go.aopphp.com
MIT License
1.66k stars 163 forks source link

Uncaught Error: Typed property Go\Aop\Framework\AbstractInterceptor::$adviceOrder must not be accessed before initialization in /var/www/html/app/vendor/goaop/framework/src/Aop/Framework/AbstractInterceptor.php #481

Closed gibrankasif closed 5 months ago

gibrankasif commented 2 years ago

Hi recently I updated the library from v2.3.5 to v3.0.0, while taking note of the breaking changes in the ChangeLog, I came to experience an error that doesn't seem to trace to any of the breaking changes mentioned. Here's the exact error which comes up: `PHP message: PHP Fatal error: Uncaught Error: Typed property Go\Aop\Framework\AbstractInterceptor::$adviceOrder must not be accessed before initialization in /var/www/html/app/vendor/goaop/framework/src/Aop/Framework/AbstractInterceptor.php:119 Stack trace:

0 /var/www/html/app/vendor/goaop/framework/src/Aop/Framework/AbstractJoinpoint.php(95): Go\Aop\Framework\AbstractInterceptor->getAdviceOrder()

1 [internal function]: Go\Aop\Framework\AbstractJoinpoint::Go\Aop\Framework{closure}()

2 /var/www/html/app/vendor/goaop/framework/src/Aop/Framework/AbstractJoinpoint.php(100): uasort()

3 /var/www/html/app/vendor/goaop/framework/src/Aop/Framework/AbstractJoinpoint.php(116): Go\Aop\Framework\AbstractJoinpoint::sortAdvices()

4 /var/www/html/app/vendor/goaop/framework/src/Instrument/Transformer/WeavingTransformer.php(142): Go\Aop\Framework\AbstractJoinpoint::flatAndSortAdvices()

5 /var/www/html/app/vendor/goaop/framework/src/Instrument/Transformer/WeavingTransformer.php(106): Go\Instrument\Transforme`

Any clue if there is another breaking change that needs to be looked out for?

daniel-sc commented 1 year ago

I got a similar issue:

Error: Typed property Go\Aop\Framework\AbstractMethodInvocation::$instance must not be accessed before initialization in vendor/goaop/framework/src/Aop/Framework/AbstractMethodInvocation.php:77

This could be resolved by changing AbstractMethodInvocation.php:30 from

protected ?object $instance;

to

protected ?object $instance = null;