Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91076 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97486 invoked from network); 4 Feb 2016 10:36:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2016 10:36:51 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:38885] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/50-27146-2C923B65 for ; Thu, 04 Feb 2016 05:36:50 -0500 Received: by mail-wm0-f45.google.com with SMTP id p63so110570077wmp.1 for ; Thu, 04 Feb 2016 02:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=QNeXRKcOA5Wry8KoUdu57hiP6HHfuI5DzmOaY9zpotY=; b=Wo+ShuPW3DfbQ8JpiFnsTuSK2ds+mGy15RoyMzGFHMwx3YwVt64UC1+/mfTnFhDDgt nw8zgr0ILWjbjerTnZVmhKC0/WFH3iKYWkjOzA8xGIcqPMwTqxxjY4G5m9pLCdsH8sHb 8f4h7ddV/I0XGtCSGBsAr4DEM7IcKB4MDjX3GwNqRfpZFZ4U3F7A9MMtmvXBrjYLYAyH yyTg7UR1TvGsFqvJeew72wE+mfvR+ZlnEETDwk0uyAQv+TEdqKmnMSYCSvL8ClYPm5JZ 1kTiiiuZ4ct/hHCaW4z7mFIUT5MyNSBxmetAyoXHXLFKVn3Fc8vJMgVyvNg03s0chSGi L3LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=QNeXRKcOA5Wry8KoUdu57hiP6HHfuI5DzmOaY9zpotY=; b=Tsbk9zXsPI2ylsmUaiMLWHdTR/aAeB+kFg6xmDEE0/+y7reZWoj8xSbh2WgmatgQ0G BoAvY5nd+WSb0crUJPEjmBrbu8pNqwy0CO0iKzv9zV1uflhI++iQZUU41H3p812UfIX0 u7mL+Syw56wVEUj79G1yd6erTG9rh+XfUWAGHbsKPGlRhDf7WiORZIfuTnPabWqqWadq yAsYd7IEDIk9XuqL5QCeQIry1oauxGbYy1plyWhbaxLFGpa9ai0Gi7b92SeLiEymWzTR AVQNaZKP8IWARHaaQnJRYjLzpT8yesZEIF/6Sa9HWFXrMFVC4F+vzHyG0YWfR949G1dN gkMg== X-Gm-Message-State: AG10YOQwZjGsUCcOQnvGrNhHBMnnEtvmRbWg50Og5OLS4e0Jzpxb7nATr5CeiOAsVcsRTA== X-Received: by 10.194.133.233 with SMTP id pf9mr7475976wjb.75.1454582207493; Thu, 04 Feb 2016 02:36:47 -0800 (PST) Received: from [192.168.0.159] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id c136sm19295747wmd.3.2016.02.04.02.36.46 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Feb 2016 02:36:46 -0800 (PST) To: internals@lists.php.net References: <56B233C0.10301@mprelu.de> <216F291E-F174-4E07-B650-DC9A63C07F61@fredemmott.co.uk> Message-ID: <56B32943.4080305@gmail.com> Date: Thu, 4 Feb 2016 10:34:43 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <216F291E-F174-4E07-B650-DC9A63C07F61@fredemmott.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant From: rowan.collins@gmail.com (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 > 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 >> DateTimeImmuteable > > It 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. 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]