Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72211 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44100 invoked from network); 4 Feb 2014 21:04:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 21:04:21 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.54 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.54 mail-qa0-f54.google.com Received: from [209.85.216.54] ([209.85.216.54:38167] helo=mail-qa0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/43-13782-1D551F25 for ; Tue, 04 Feb 2014 16:04:19 -0500 Received: by mail-qa0-f54.google.com with SMTP id i13so13033453qae.41 for ; Tue, 04 Feb 2014 13:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FiNI5k+/nx3crHTfQHc2HktWwFqRIe+CuU1MMMFZ7SI=; b=VYN6ww650u2+EpcFgGKXhrc69rxtUxngWrXPoP8AnuOpX4y5tgukFzX1VXKKYh8Tg7 Zj1lAcSafBYnKHo5cAM4CunLbhq4EsexCn20ZbuGpf9SfV7/2P3r3hAOjcYDp/q7a6dW Rg2XT2+9Fx3i3Fc1wzDwASaad26FzJEiQoCucwjI2hOoergp5CJyG04gYHTuMN7IrUH0 hQ2BhxwjENAqxX7yjt1Sq1lxEINsdWNmKSivEGUg5aSPUuIY28IfVyognEpJdQabvCaa yR1It78MPov6sSsgAxhNxtiZJUxaQo7y1HfMlsBxg5QvrWKOMMH17mo8WbxHa99CMV9S IuxQ== MIME-Version: 1.0 X-Received: by 10.140.88.180 with SMTP id t49mr66234144qgd.97.1391547855055; Tue, 04 Feb 2014 13:04:15 -0800 (PST) Received: by 10.140.96.70 with HTTP; Tue, 4 Feb 2014 13:04:14 -0800 (PST) In-Reply-To: <52F14C66.3030806@gmail.com> References: <52EF4BF8.60005@sugarcrm.com> <52F14C66.3030806@gmail.com> Date: Tue, 4 Feb 2014 22:04:14 +0100 Message-ID: To: Rowan Collins Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c13b1096b22204f19afbcd Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: tyra3l@gmail.com (Ferenc Kovacs) --001a11c13b1096b22204f19afbcd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 4, 2014 at 9:24 PM, Rowan Collins wrot= e: > On 04/02/2014 09:08, Yasuo Ohgaki wrote: > >> Similar thing could be achieved with new assert() w/o any overheads. >> >> https://wiki.php.net/rfc/expectations >> >> assert('version_compare(PHP_VERSION, "5.5.0", ">=3D")', 'You need PHP 5.= 5.0 >> or later'); >> > > I'm confused, isn't this exactly how assert() already works? What needs t= o > change, for this example in particular? > > Here it is running on several versions, giving a Warning by default: > http://3v4l.org/TrBJm > And here it is without the second parameter, which in itself requires PHP > 5.3: http://3v4l.org/mcQI6 > > It's slightly confusing that assertions issue a Warning even with > ASSERT_BAIL turned on, but with that turned on (which can be at the ini > level) you can see that it aborts the script as desired: > http://3v4l.org/QZLog > > Regards, > > -- > Rowan Collins > [IMSoP] > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > with the current assert implementation the assert is a function, which eval()-s the expression argument, but it will return early if asserts are disabled(http://lxr.php.net/xref/PHP_5_5/ext/standard/assert.c#149) with the proposed assert (https://wiki.php.net/rfc/expectations) the assert will be changed into a language construct, which has the advantage that we can use expressions instead of passing a string for evaluation without additional cost, also executing that is cheaper than a function call, and when the assertions are disabled they will be almost zero-cost. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a11c13b1096b22204f19afbcd--