[PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Davey Shafik
Hi all, 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. It's actually very difficult to be able to reliably determine that you are running the _real_ PHP runtime and not something mi

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Dan Ackroyd
On 3 February 2016 at 09:03, Davey Shafik 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 t

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Andreas Heigl
Am 03.02.16 um 17:54 schrieb Dan Ackroyd: > On 3 February 2016 at 09:03, Davey Shafik 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

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Matt Prelude
Hi, On 03/02/16 16:54, Dan Ackroyd wrote: On 3 February 2016 at 09:03, Davey Shafik 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 delib

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Kinn Julião
On Wed, Feb 3, 2016 at 12:07 PM, Matt Prelude wrote: > Hi, > > On 03/02/16 16:54, Dan Ackroyd wrote: > >> On 3 February 2016 at 09:03, Davey Shafik wrote: >> >>> Hi all, >>> >>> It's actually very difficult to be able to reliably determine that you >>> are >>> running the _real_ PHP runtime and

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Sara Golemon
> 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). > That's exactly why PHP_VERSION is faked in HHVM. Because that's how users use

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Stanislav Malyshev
Hi! >> there to be helpful i.e. HHVM x.y.z === PHP a.b (feature-wise). >> > That's exactly why PHP_VERSION is faked in HHVM. Because that's how And I think it is the right choice. PHP_VERSION essentially (also) means the version of the spec and of the implementation. And people do depend on it (

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Fred Emmott
> On Feb 3, 2016, at 2:00 PM, Davey Shafik wrote: > > On Wednesday, February 3, 2016, Sara Golemon > wrote: > > Unfortunately Sara, the types of things you generally have to work around > are minor things, like differences in DOM, or the inability to json_encode > DateT

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Davey Shafik
Currently, HippyVM doesn't even _have_ a version constant. Because it's trying to pretend to be PHP. Having a "YOU MUST FILL THESE CONSTANTS WITH YOUR OWN RUNTIMES DATA" in the spec is intended to help that situation. Right now, there's no way to tell what version of HippyVM you're running on, and

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Fred Emmott
> On Feb 3, 2016, at 4:03 AM, Davey Shafik wrote: > > Hi all, > > 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. > > It's actually very difficult to be able to reliably deter

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-03 Thread Fred Emmott
Fair enough - though I’m not convinced that it would be effective: if successful, it would allow people to do 90’s-browser-sniffing-style if ($engine !== ‘my favorite’) throw Exception(’sorry, not supported yet’);, so it seems fairly likely that implementations would end up lying about it (and y

Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant

2016-02-04 Thread Rowan Collins
Fred Emmott wrote on 03/02/2016 22:14: On Feb 3, 2016, at 2:00 PM, Davey Shafik wrote: On Wednesday, February 3, 2016, Sara Golemon mailto:poll...@php.net>> wrote: Unfortunately Sara, the types of things you generally have to work around are minor things, like differences in DOM, or the inabil