Hi all, I want to bring forward a very simple RFC to help solve an issue I had this week of writing unit tests that take into account differing behaviors in PHP and HHVM.
It's actually very difficult to be able to reliably determine that you are running the _real_ PHP runtime and not something mimicking it. And while it's easy to detect HHVM, for example, there's no way to detect not-PHP, or to reliably detect any other number of runtimes. Therefore, I'd like to propose we add a simple string constant, PHP_ENGINE that contains the runtime name, be that 'php', 'hhvm', 'hippyvm', or something else. Additionally, because you are likely to want to also know the version of said engine, and don't want to mess around with checking the engine appropriate constants based on the value of PHP_ENGINE (e.g. HHVM_VERSION), I'm proposing we also add PHP_ENGINE(_*)_VERSION(_ID), which means you can then check all the version constants for whatever VM you happen to be on easily. This also means that we can agree on the current behavior of using PHP_VERSION (and PHP(_*)_VERSION(_ID) to allow the running on legacy code that depends on it, on newer runtimes. RFC, with patches, is here: https://wiki.php.net/rfc/php_engine_constant Thanks, - Davey