Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72076 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43174 invoked from network); 3 Feb 2014 10:56:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 10:56:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.41 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.41 mail-la0-f41.google.com Received: from [209.85.215.41] ([209.85.215.41:44240] helo=mail-la0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/51-35654-BC57FE25 for ; Mon, 03 Feb 2014 05:56:11 -0500 Received: by mail-la0-f41.google.com with SMTP id mc6so5383022lab.28 for ; Mon, 03 Feb 2014 02:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=E/opdBHLyMp2OZ3umOLWb8Tzdr/dG+enJR73O/sQSWk=; b=RJbgbSaBvZ+tX2E4PIjw9Qb33srOMBbEQoNYiDiUr1W/22QghH/7bQ5q3e0EMBRdl1 ZwweTC9z8CqcXVVeogP0EWX3jaawZo5tJqlP+GCXUb+8p51OFXrbuoCiRxYhlX/tWGNS OpEPqHERDACuKQW5vPnN2yCWh680+FcsZEo5pnTC+RoCxqgnXqE3ctAl+yhk+TsJivvr zY8kiy7olsE6v4TUjC9m9hcJqhU5nSlmi8zzhsOaKIbjAa6k6MESiDSHCWLC56VE+GQv Bk4jt/Rtf3ljYInwutQb66IRdbnASV00wmMnNWCgChUf049s/cpxNb2M1aNcKgZDdrI9 CgUA== X-Received: by 10.152.234.36 with SMTP id ub4mr6823154lac.13.1391424967980; Mon, 03 Feb 2014 02:56:07 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Mon, 3 Feb 2014 02:55:27 -0800 (PST) In-Reply-To: <52EF4BF8.60005@sugarcrm.com> References: <52EF4BF8.60005@sugarcrm.com> Date: Mon, 3 Feb 2014 19:55:27 +0900 X-Google-Sender-Auth: mt2oUXQEuj_DC1t8M4PLz8n1sVU Message-ID: To: Stas Malyshev Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11344e5af2ba7804f17e5eb2 Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11344e5af2ba7804f17e5eb2 Content-Type: text/plain; charset=UTF-8 Hi Stas, On Mon, Feb 3, 2014 at 4:57 PM, Stas Malyshev wrote: > > The same thing can be done by version_compare() and die(), but it does > not > > make much sense executing script only to check PHP version and die, > > especially for libraries. For library, it is preferred to fail when it is > > Why not? That's what PHP does - executing scripts. > > > included, not when it is executed. I wouldn't write version_compare() and > > I don't understand - what is the difference? In PHP including and > executing is the same thing. > > I think version_compare works just fine. I works, but it requires CPU time for it and evaluation is delayed at run time, not compile time. Isn't it nice to know requirement is not met? We may extend declare() more. For example, loaded extensions. declare(module='pgsql,openssl'); With this, we could eliminate code like if (!extension_loaded('foo')) { die('You need foo module'); } if (!extension_loaded('bar')) { die('You need bar module'); } With opcache loaded extension check may be completely skipped. Evaluation at compile time and run time differs. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11344e5af2ba7804f17e5eb2--