Re: [RFC] Add PHP_ENGINE Constant
| From: | Matt Prelude | Date: | Wed, 03 Feb 2016 17:07:12 +0000 |
| Subject: | Re: [RFC] Add PHP_ENGINE Constant | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91063@lists.php.net to get a copy of this message | ||
Hi,
On 03/02/16 16:54, Dan Ackroyd wrote:
On 3 February 2016 at 09:03, Davey Shafik <davey@php.net> wrote:I can see how this could be useful. Would get my +1 if I had a vote.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).