On Mon, Sep 5, 2016 at 11:19 AM, Andrea Faulds <a...@ajf.me> wrote: > Hi Davey, > > Davey Shafik wrote: > >> A while back I brought a small RFC to internals, that proposed a set of >> constants that were specifically for alternative implementations to >> identify themselves as such if they want to conform to the spec. >> >> https://wiki.php.net/rfc/php_engine_constant >> >> There were some folks who didn't like it, but nobody suggested different >> implementations, just didn't feel it was necessary. As such, I'm planning >> to >> bring it to a vote next week - this is simply a heads up as it's been a >> while >> and I want to give a chance for any objections other than not wanting it >> to >> be voiced before I open it up for voting. >> > > This is an interesting idea. Have you asked the HHVM team what they think > about it? Their input is probably more important than ours, as the foremost > alternative implementation. > > The implications of it are interesting. Currently, PHP doesn't really have > any separation between the current version of the PHP interpreter and the > version of the language. Despite the specification efforts, PHP versions > are effectively defined by the main implementation. > > Would this RFC be changing that, decoupling the version of PHP, the > language, from PHP, the interpreter? Would we no longer report the version > of PHP as, say, “7.1.1”, but instead as just “7.1”, and put “7.1.1” as the > engine version? The micro version, at least with the modern release > process, is only meaningful for the PHP interpreter, and not other > implementations. >
As per the RFC, the PHP_*_VERSION (and related constants) and the PHP_ENGINE_*_VERSION constants would be the same for php.net. > Also, isn't there a danger of code sniffing for the engine? I wouldn't be > entirely surprised if, in future, HHVM might start pretending to be PHP by > default. > This is actually the problem right now, they already _do_ this, despite not being 100% to spec. Then you need to check for HHVM_VERSION and work around those differences. Instead, it would be better to check PHP_ENGINE === 'hhvm' && PHP_ENGINE_VERSION_ID <= 30813 > Anyway, that's just a few thoughts of mine. Thanks! - Davey