Re: [RFC] Add PHP_ENGINE Constant

From: Date: Wed, 03 Feb 2016 17:06:42 +0000
Subject: Re: [RFC] Add PHP_ENGINE Constant
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-91062@lists.php.net to get a copy of this message
Am 03.02.16 um 17:54 schrieb Dan Ackroyd: > On 3 February 2016 at 09:03, Davey Shafik <davey@php.net> wrote: >> Hi all, >> >> It's actually very difficult to be able to reliably determine that you are >> running the _real_ PHP runtime and not something mimicking it. > > The underlying problem seems to be caused by HHVM deliberately > 'faking' the results of calls to zend_version() and the existing > constants. What is there to stop any other PHP implementations from > returning 'fake' data for that function or these new constants? > > And just to play devils advocate, why isn't this a problem that should > be solved in those other versions of PHP? They're the ones re-using > version strings and so causing confusion. > > I can see how this could be useful....I just can't see how this would > be a permanent solution to the problem. As someone else said, this > sounds like the old detecting browsers via "user agent headers" for > browser detection. That became a complete nightmare as browsers kept > imitating each other, and so the rules about strings became less and > less useful. > > Perhaps it might be helpful to justify the RFC, if you can give some > more context as to why code needs to know about what VM it is running > on? Especially when running tests on f.i. Travis-CI you can set an environment variable to describe what environment you are supposed to be in. In all other cases feature-detection (function_exists/extension_loaded f.i.) should work fine to determine whether the used engine is able to run a certain function. And in the end the goal would be to not adapt the code to different runtine-engines but to adapt the runtime engines to run the code in the same manner. That's what the language-specification is there for. My 2 Cent Cheers Andreas > > cheers > Dan > -- ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andreas@heigl.org N 50°22'59.5" E 08°23'58" | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +---------------------------------------------------------------------+ | http://hei.gl/root-ca | +---------------------------------------------------------------------+

Attachment: [application/pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
« previous php.internals (#91062) next »