Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91060 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98116 invoked from network); 3 Feb 2016 09:03:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2016 09:03:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@daveyshafik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@daveyshafik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain daveyshafik.com from 209.85.161.175 cause and error) X-PHP-List-Original-Sender: me@daveyshafik.com X-Host-Fingerprint: 209.85.161.175 mail-yw0-f175.google.com Received: from [209.85.161.175] ([209.85.161.175:36517] helo=mail-yw0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/30-28520-972C1B65 for ; Wed, 03 Feb 2016 04:03:54 -0500 Received: by mail-yw0-f175.google.com with SMTP id q190so5093703ywd.3 for ; Wed, 03 Feb 2016 01:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daveyshafik-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=Ga7UvxmFA4G2YKfaR71CaMTolqJ30ufyzAeQ+QJxTws=; b=qBAjWu+vd10BbwUjLQBXhIfnjSWXwt82MTVOj7ETT6/f+GY1BVUrIWT/HOUWtl82FY MzdKF+Bl0s9LPVFdgMN5nBaH8le/9d6A5h+8TyMGgS51FtlsVEW5+ozU/mic6czZRP82 CLTxaS2pbCVYmMeYCkjf34robVIMjYXG65tx4NBbgbIQvOwReKzJhPrP0itf0ShcmS79 68aLiZsxgrLJyFHC8U27YQX/iAjVf2uvJmFF+QvDH8RA3IyIfC+UsC6Lds5qTSA2YsNc cNOc2oZISuBycaRGEg+Tj5mO0YK9MbPujGDFMXHFWATOhfRqClo+E/NgZZ63g7l5HfW4 geSg== 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:date:message-id:subject:from :to:cc:content-type; bh=Ga7UvxmFA4G2YKfaR71CaMTolqJ30ufyzAeQ+QJxTws=; b=kUXy1cWB8pamD91XAQS3YP9DMSlwrW4VYpAsccTe5mEFVgZDYpUKAzevl9UMbnWZMT OO4bYghZHrId7rXkC7N1OKWGW+OFfN+x+D3Ikt1zZ0D8ssBUjRvr6ivrBNg7VDeEK/gJ YIayahU6OqvSa+aakOJESpSUSHHKL7SfnV0DleO59sS2iyuHdztjcWoGsnmZ9FcZnFDG tPovf4ATt25QxztIsPLqclLr17fmoxVXECY4quYIGGda/PFCPOptOs772PgoGOs5fLyh z4Jk5NRWsrX0ddqH9Q97CKH+xlGyGad9dRHZHlESrSQJrC5HdJsBmvsPnPzW5GebMLrk I5Wg== X-Gm-Message-State: AG10YORcDyHX5VEOBBzwdJLWMZ4036qz2OF9IsliVQGDv3M0/js/zKkiLLOY9NqMc0xuOOqN4CpCkVEmAnEEJyhE MIME-Version: 1.0 X-Received: by 10.129.153.137 with SMTP id q131mr192584ywg.90.1454490231311; Wed, 03 Feb 2016 01:03:51 -0800 (PST) Sender: me@daveyshafik.com Received: by 10.129.159.193 with HTTP; Wed, 3 Feb 2016 01:03:51 -0800 (PST) Date: Wed, 3 Feb 2016 04:03:51 -0500 X-Google-Sender-Auth: OGnyUe9tpI22dCnvuslqDIO_reQ Message-ID: To: "internals@lists.php.net" Cc: Sara Golemon Content-Type: multipart/alternative; boundary=94eb2c0b8fb6916210052ad9e5ab Subject: [RFC] Add PHP_ENGINE Constant From: davey@php.net (Davey Shafik) --94eb2c0b8fb6916210052ad9e5ab Content-Type: text/plain; charset=UTF-8 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 mimicking it. And while it's easy to detect HHVM, for example, there's no way to detect not-PHP, or to reliably detect any other number of runtimes. Therefore, I'd like to propose we add a simple string constant, PHP_ENGINE that contains the runtime name, be that 'php', 'hhvm', 'hippyvm', or something else. Additionally, because you are likely to want to also know the version of said engine, and don't want to mess around with checking the engine appropriate constants based on the value of PHP_ENGINE (e.g. HHVM_VERSION), I'm proposing we also add PHP_ENGINE(_*)_VERSION(_ID), which means you can then check all the version constants for whatever VM you happen to be on easily. This also means that we can agree on the current behavior of using PHP_VERSION (and PHP(_*)_VERSION(_ID) to allow the running on legacy code that depends on it, on newer runtimes. RFC, with patches, is here: https://wiki.php.net/rfc/php_engine_constant Thanks, - Davey --94eb2c0b8fb6916210052ad9e5ab--