Am 03.02.16 um 17:54 schrieb Dan Ackroyd: > On 3 February 2016 at 09:03, Davey Shafik <[email protected]> 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:[email protected] N 50°22'59.5" E 08°23'58" |
| http://andreas.heigl.org http://hei.gl/wiFKy7 |
+---------------------------------------------------------------------+
| http://hei.gl/root-ca |
+---------------------------------------------------------------------+
smime.p7s
Description: S/MIME Cryptographic Signature
