On Wed, Feb 3, 2016 at 12:07 PM, Matt Prelude <m...@mprelu.de> wrote:
> Hi, > > On 03/02/16 16:54, Dan Ackroyd wrote: > >> On 3 February 2016 at 09:03, Davey Shafik <da...@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? >> >> cheers >> Dan >> >> I think Dan raises some interesting points, although I think > zend_version() is often used for feature detection so they try to put a > zend version in there to be helpful i.e. HHVM x.y.z === PHP a.b > (feature-wise). > > I can see how this could be useful. Would get my +1 if I had a vote. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I agree with Andreas when: 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. If the motivation is: > 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. I suggest the following http://hhvm.com/blog/2393/hhvm-2-3-0-and-travis-ci and instead of introducing one more constant, you could easily use *if (defined('HHVM_VERSION')) {}* -- *--* *Kinn Coelho Julião* *Toronto - ON/Canada*