Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91068 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44966 invoked from network); 3 Feb 2016 19:00:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2016 19:00:52 -0000 Authentication-Results: pb1.pair.com header.from=me@daveyshafik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@daveyshafik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain daveyshafik.com from 209.85.160.182 cause and error) X-PHP-List-Original-Sender: me@daveyshafik.com X-Host-Fingerprint: 209.85.160.182 mail-yk0-f182.google.com Received: from [209.85.160.182] ([209.85.160.182:36598] helo=mail-yk0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/C1-34960-36E42B65 for ; Wed, 03 Feb 2016 14:00:52 -0500 Received: by mail-yk0-f182.google.com with SMTP id z7so27533003yka.3 for ; Wed, 03 Feb 2016 11:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daveyshafik-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=/wdTHS5kR/yuBfudP4V5sSuu6DaLbLk3eVELczlrzI0=; b=iU0Ws68P9fSvSC+nBJBHLLIWutDEX+Mwfu8U3ghkAKQaEOjGWA12Yntd1XxFxiUK58 lgql2eurtBQIb0Oe+ePj4EFGtuh6iO0aDsCPw4KmdrU9R9diL3NGdw4Hw0APwqZy4BKE ejrD3ECZRBKVMlcn4r/9FZIRXahaGYQCd3QnNIAsUMREoanedACqDBVcZJx1Ux71bEKL O4CBEsoF5N2i83H77ruYlmeFzQSaULuN7ReLFErvNXI5IZ9XExDINK4g8Dkxo5DHMzSq MapTZ+khFSyFgzZYWO29apvXIz8tBmHCnW7dPL2GqFmfYUSwgxejEPdpJXcGgkCsSqo/ LZGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=/wdTHS5kR/yuBfudP4V5sSuu6DaLbLk3eVELczlrzI0=; b=PRX/5n4m3Q6bkNbJsel+39ll3QZ+WM/VpgkUNQCiFJy8oPvr4SzWXoUgvdeZXDdPQp 4CJ1ErgYY6dVw3+Uizu63iCcRsEl37JaeGGW16M2u8eILIWHTZ6sFEIepSiswbwG7APW sdfgK66Ab1xB8evbd5ZkbIFzbQGR2IUspXDAt/Vs67iUZcoc2K3wyxo8+XTAtRfrH0HW YEXXVozzN0aYQvVPmmPD6ZbgDRnVsCpZvLuZhJxsiKD7srKp9WLhDmyWnG2bJrNXlnc+ bdH8Op2MPdY5MNCtkggUdLBtrL/U9KvKOsWpOO4MSbuG5e0XWVDvxkNY7xjT993q21js VzRQ== X-Gm-Message-State: AG10YOQjV2gvyk6rOECsgW4fFi12P6G88GYXCBNDJ/2elondv3LwQdYqqh/mmFCObrhaZFh+Gv5D/uwPhggvGhO9 MIME-Version: 1.0 X-Received: by 10.129.159.206 with SMTP id w197mr1907735ywg.233.1454526049015; Wed, 03 Feb 2016 11:00:49 -0800 (PST) Sender: me@daveyshafik.com Received: by 10.129.159.193 with HTTP; Wed, 3 Feb 2016 11:00:48 -0800 (PST) In-Reply-To: References: <56B233C0.10301@mprelu.de> Date: Wed, 3 Feb 2016 14:00:48 -0500 X-Google-Sender-Auth: VwrUNsWy5SfrjlG7eVCwY-l4C94 Message-ID: To: Sara Golemon Cc: Matt Prelude , PHP internals Content-Type: multipart/alternative; boundary=94eb2c0b752e7810fc052ae23c39 Subject: Re: [RFC] Add PHP_ENGINE Constant From: davey@php.net (Davey Shafik) --94eb2c0b752e7810fc052ae23c39 Content-Type: text/plain; charset=UTF-8 On Wednesday, February 3, 2016, Sara Golemon wrote: > > 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 it. Essentially, we're treating PHP_VERSION as "PHP > language specification version X.Y" So for example, hhvm 3.12.0 > conforms to phplang-spec 7.0.0 so it defines HHVM_VERSION to tell what > it is, while PHP_VERSION exists for all those scripts that were > written under the assumption that there's only one PHP runtime. > > I would actually suggest that if something like this RFC goes through, > we formally define PHP_VERSION in exactly that way. As a language > specification conformance advertisement. PHP_ENGINE_VERSION would be > the build ID for the actual runtime implementation. In the case of > the reference implementation, these numbers would be identical, so > there would be no effective change. In the case of other > implementations, they'd differ. For example on HHVM you'd have: > PHP_VERSION=7.0.0, PHP_ENGINE=hhvm, PHP_ENGINE_VERSION=3.12.0 > > All that said, I'm not convinced we *need* explicitly enumerated > constants like PHP_ENGINE, but for that 0.1% of scripts that care who > they're running under, it would certainly unify that detection in a > useful way. > > To the question of "are we just replicating browser detection and all > its problems?", I'd offer that perhaps the solution lies not in more > constants, but in Reflection. For example: > > class ReflectionLanguage { > public function isSupported($feature): bool; > public function variableSyntaxConformance(): string; > public function strictTypehints(): bool; > } > > Some of these would be compiler constant-ish, others might be per-file > (like strictTypeHints()). > > ^^ The above is a half-baked idea, please alter/destroy it at will. > 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 I do however like the idea of feature detection - I wonder if perhaps we could do something where it's done at compile time and therefore minimally impacts runtime? --94eb2c0b752e7810fc052ae23c39--