Codeception/AspectMock

AspectMock on HHVM

Closed this issue · 3 comments

Hello,

I have setup AspectMock to work with my Laravel application running on Codeception. Using PHP, it works fine, however when using HHVM I get this error.

Warning: File not found: 

php://filter/read=go.source.transforming.loader/resource=/liputan6_vagrant/vendor/codeception/aspect-mock/src/AspectMock/Core/Mocker.php in /liputan6_vagrant/vendor/lisachenko/go-aop-php/src/Go/Instrument/ClassLoading/AopComposerLoader.php on line 99

Fatal error: Class undefined: AspectMock\Core\Mocker in /liputan6_vagrant/vendor/codeception/aspect-mock/src/AspectMock/Kernel.php on line 30

Looking through the go-aop-php issues I found this goaop/framework#143 which seems to indicate that for the most part, HHVM support is in place. Might there be a workaround that gets AspectMock working on HHVM as well ?

@kusut unfortunately, HHVM is not supported due to some limitations of HHVM JIT machine (Closure::bind is unavailable in Repo mode). Moreover, HHVM has buggy implementation of ReflectionMethod->getClosure() which is used by Go! AOP engine.

So, there is only small chance to create custom ReflectionMethod->getClosure() method (extend class and override it) with correct behaviour to make it work under HHVM.

lisachenko, it seems it's not entirely in your control but do you see any roadmap on having HHVM working with go aop anytime soon?

@newtonianb HHVM developers don't want to break their existing codebase for magic things like closure rebinding, so there is only small chance to make framework working with HHVM ( Shame about that, but I'm happy that framework can run on PHP7 natively and this is good sign for me, because all JIT and memory optimizations can improve the performance of AOP.