Closed rahmatrh199 closed 4 years ago
This will not work for internal classes from top-level namespace. No magic here.
Also you have an error in your pointcut syntax. If you are using @execution
signature then it will match all methods that have specific annotation and accepts an argument with annotation class name, not a method signature.
For general methods you should use simple execution
type (without \@ symbol) and specify method signature (this includes a visibility modifier as well public
or protected
.
To see an examples, please look at this test code: https://github.com/goaop/framework/blob/master/tests/Go/Aop/Pointcut/PointcutParserTest.php#L62-L123
@lisachenko please tell me that , Is there any other way to perform AOP on predefine or inbuild php classes classes.
@rahmatrh199 you could try extensions )) like uopz
, runkit
, aop_php
. But I'm not sure if they will work for you on production.
/**
[Tue Feb 04 10:37:58.688989 2020] [php7:error] [pid 14595] [client ::1:12929] PHP Fatal error: Uncaught Dissect\Parser\Exception\UnexpectedTokenException: Unexpected -> at line 1.\n\nExpected one of ), nsSeparator. in /var/www/html/Agent/framework/vendor/jakubledl/dissect/src/Dissect/Parser/LALR1/Parser.php:60\nStack trace:\n#0 /var/www/html/Agent/framework/src/Core/AbstractAspectLoaderExtension.php(121): Dissect\Parser\LALR1\Parser->parse()\n#1 /var/www/html/Agent/framework/src/Core/AbstractAspectLoaderExtension.php(71): Go\Core\AbstractAspectLoaderExtension->parseTokenStream()\n#2 /var/www/html/Agent/framework/src/Core/GeneralAspectLoaderExtension.php(77): Go\Core\AbstractAspectLoaderExtension->parsePointcut()\n#3 /var/www/html/Agent/framework/src/Core/AspectLoader.php(181): Go\Core\GeneralAspectLoaderExtension->load()\n#4 /var/www/html/Agent/framework/src/Core/AspectLoader.php(100): Go\Core\AspectLoader->loadFrom()\n#5 /var/www/html/Agent/framework/src/Core/CachedAspectLoader.php(74): Go\Core\AspectLoader->load()\n#6 /var/www/html/Agent/framework/src/Core/AspectLoader.php(121): Go\Core\CachedAspectLoader->loa in /var/www/html/Agent/framework/src/Core/AbstractAspectLoaderExtension.php on line 139, referer: http://localhost/Agent/framework/demos/