Re: [RFC] Add PHP_ENGINE Constant
| From: | Rowan Collins | Date: | Thu, 04 Feb 2016 10:34:43 +0000 |
| Subject: | Re: [RFC] Add PHP_ENGINE Constant | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91076@lists.php.net to get a copy of this message | ||
Fred Emmott wrote on 03/02/2016 22:14:
Maybe what's actually needed is not something in the PHP spec itself, but a PHP equivalent of modernizr (https://modernizr.com/) - a library with a set of feature detections which bypass the whole question of "real PHP" or needing to know the exact quirks of every implementation. It would also be much easier to maintain and extend if it existed outside of any implementation, rather than needing every implementation to keep up with a growing list of requirements [first feature to detect: is the feature detection API present? ;)] It could perhaps take the form of a set of unit tests which you run as part of a build process that then writes out a profile of the current environment. This would allow you to detect even things which cause fatal errors on some implementations, by triggering the error in a sub-process, and would be more efficient than probing them at runtime. Regards, -- Rowan Collins [IMSoP]On Feb 3, 2016, at 2:00 PM, Davey Shafik <davey@php.net> wrote: On Wednesday, February 3, 2016, Sara Golemon <pollita@php.net <mailto:pollita@php.net>> 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 DateTimeImmuteableIt seems like the main thing this RFC would change is that you could easily do “if ($engine !== ‘php’)” - but for almost all the examples I can think of, and yours, what’s actually needed is if "($engine === ‘specific_engine_that_needs_a_workaround’)”, so I don’t see a benefit over using HHVM_VERSION or similar. The one exception I can think of is if someone’s reimplementing phpinfo() or similar.