Closed TysonAndre closed 7 years ago
This likely will not work as you want it to, at least if you set auto_enable
.
Depending on the PHP SAPI you use multiple requests will be served by one PHP process; if the first request is handled by a legacy one, then registerExtension
will happily add it. If the next request goes to a new application version that one will auto-enable the extension, yet initialize with a snapshot.
Summary
Because snapshots are incompatible with extensions, there should be a way to prevent PHP from using extensions, completely.
https://github.com/phpv8/v8js#snapshots
My use case:
A website using long-running
httpd
processes. This is capable of running code from different branches of the same codebase. Some of the branches may be older, and continue to call V8Js->registerExtension(). There's no limit on how old the branches can beI want to start using createSnapshot. I'm fine with very old branches not working, but don't want the new branches to crash or break.
So I can check `if (method_exists($v8js, 'registerExtension')) { code using extension } else { code using snapshot; }