antecedent / patchwork

Method redefinition (monkey-patching) functionality for PHP.
https://antecedent.github.io/patchwork/
MIT License
444 stars 40 forks source link

Fix return values from patched functions on HHVM #29

Closed rarescosma closed 9 years ago

rarescosma commented 9 years ago
$ php --version
HipHop VM 3.9.1 (rel)
Compiler: tags/HHVM-3.9.1-0-g0f72cfc2f0a01fdfeb72fbcfeb247b72998a66db
Repo schema: 6416960c150a4a4726fda74b659105ded8819d9c

When running our phpunit test suite on HHVM we noticed a bunch of failures and notices. A little digging proved that return values from functions patched with Patchwork were always null.

Turns out the $result is not initialized and returned properly in the fb_intercept closure. This is what the patch addresses.

antecedent commented 9 years ago

Many thanks; it seems I had messed up big time on this one. Turns out assertions are automatically disabled on the HHVM that Travis-CI provides. The tests seemed to pass, but in reality, nothing worked at all.

Your patch is now live, but there are still some failures; I will be working on those.

rarescosma commented 9 years ago

Awesome, thanks for getting back!

Waiting for the release so we can be fork-free again :smile:

antecedent commented 9 years ago

Version 1.3.5 has just been tagged :)