Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42565 invoked from network); 3 Feb 2016 18:48:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2016 18:48:21 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.180 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.180 mail-lb0-f180.google.com Received: from [209.85.217.180] ([209.85.217.180:36368] helo=mail-lb0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/51-34960-57B42B65 for ; Wed, 03 Feb 2016 13:48:21 -0500 Received: by mail-lb0-f180.google.com with SMTP id dx2so17525868lbd.3 for ; Wed, 03 Feb 2016 10:48:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=3RQhR5O/we7/ALWa81sAmjB0BxijfS55glIYPe6YsMU=; b=ICRngbmEVnIu5ByCb8x7LNavohMoAcaeMTsSKNH7+B1CTEk3EXpyDtnk0+P5tC7r6Q 9sL7CchmdthLbitoCujIQebSclOQio1RU7jLKxSyJ0yxtXhZojfTOToJVEJZ5EuwYyxK nQKSAotfA6kVvxDshZ0Fi+tpt02vM3yKv5yKwhEu7cJ6uXumwnh1KO+9c1mF9NMVJn5o CdkoouSLlo3PPU3rX3SsfDsxQxeayP/0QfZ5XjSAH5e8tkfXJZXJlW854Zi7E8T/wvUA 39C2mhvJPRSbhdOpaw2BqiaJckvlNxbnmU26PNntCbLU5UkjEF9lDVae94AiLKp/bstK GvUA== 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=3RQhR5O/we7/ALWa81sAmjB0BxijfS55glIYPe6YsMU=; b=W2Vjf3eFiEyhLZ0FNiQ98VqRfWSLYtn2X5H/9mX+q2r1Q7Al39GMu+gkj0vqVD+7TO mwUSZprRJAkoNTwCzQX5Gf18S+LjYtbpa2Mi3y/89Nunz9BBaGwwyNHVers0UyCLkvOn KRONVmNGSnEYnfv9JOyE+iyr4lHeWmua8s+I1QpCBH8wgr85GshMjYlUi+ajTNuer+6W zjdXZPGjUziLx6hpyZlmIib6Bjim+b3z8GjAZlaFhZB6htaMCHMDt5pZXcUWW0ftYgWq Nf19JrUyFRD0aE0V/8AaBI3pWB4WLE2w8IHRcQIR3P89/69935eqpeHnqqmzxEC3FDbu GPlA== X-Gm-Message-State: AG10YOSsPibsMcKwIPGsUBM4vFEsgZS2bNYvfLqDS3nd8LPMhtVl7yK0/ujcj8yEZlaBV+2iBbzrmViTtEhy4g== MIME-Version: 1.0 X-Received: by 10.112.135.131 with SMTP id ps3mr1570639lbb.68.1454525298361; Wed, 03 Feb 2016 10:48:18 -0800 (PST) Sender: php@golemon.com Received: by 10.112.37.44 with HTTP; Wed, 3 Feb 2016 10:48:18 -0800 (PST) X-Originating-IP: [199.201.64.3] In-Reply-To: <56B233C0.10301@mprelu.de> References: <56B233C0.10301@mprelu.de> Date: Wed, 3 Feb 2016 10:48:18 -0800 X-Google-Sender-Auth: EjAGZdDBN9rGUAEV5QoweoAqC70 Message-ID: To: Matt Prelude Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Add PHP_ENGINE Constant From: pollita@php.net (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 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. -Sara