Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88470 invoked from network); 14 Feb 2018 15:40:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2018 15:40:14 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.181 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.161.181 mail-yw0-f181.google.com Received: from [209.85.161.181] ([209.85.161.181:38476] helo=mail-yw0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/43-26725-C58548A5 for ; Wed, 14 Feb 2018 10:40:13 -0500 Received: by mail-yw0-f181.google.com with SMTP id w78so1271467ywd.5 for ; Wed, 14 Feb 2018 07:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=HoZNVHxcp+FcsbeI/i0DDaUun6aRTJP4Ns4iw4+VUHc=; b=gyesp1bNshXNhJ5r/7F++I0Cxpa6O46LO8UlLV/XDMWioXY3rkFyPsVDG46sO3kItp F+c66smm/FORwlJC6aHQK0yQSK9iTzC/TCLJ5XdswByxEv+lfU24yd5eEL2nVQzmpBCI qJ3pv9biwdf2buN3DhswHZ0f/yhs3CaPIKZE8Ai1CH6gjM19B/jYF9jJhfU3hc082lDx KctxyzaTVsoVvqWaAr7J40r2YqTGsCiXZXg15tCdIcVBmGH/7+HHumQEqeQazXlb6WmU 1pE3ezsgZ2bWQjq/s3kr2FTc+rk1giVjOII+rKMH0iRoKs+OJSfA/mAQMHaLLVJ1M2+T zgSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=HoZNVHxcp+FcsbeI/i0DDaUun6aRTJP4Ns4iw4+VUHc=; b=hqGh1X0ux8F1P0diuDoOCrCaWr/d3iQ/qxQ+y/jfvRpDZkok94OweZn2VIuZISNBvb nVZ5Ew1R/1OaeNS0eb150XQPmJomudh03uuRbfjUBS+3jr0mfwLrqTTbBNEkYlB0mHTk Er6dwA4TUqc9AVO+hcMVoWZcnFObrV0lNOoZ3fX/iQwMDt1CGQahV7IDJpmhrfF5+xBG 6SB/x5xEyslQyoYRRIcUwMgk2HkJMArRP0xOi93QnB2xzKuQKeE9AouUBo7ACrjobNRy fPANggeDz2vmsPP/F6JXkSxjul7YLG6HeAGFbYV1unz/QesQVlkHCdCj7HYj4syL/6EO 2vnA== X-Gm-Message-State: APf1xPBkinqdFS1VssL/OGO125kwO2LGWFeXThWEycMuMYR4hJR0rc+r ZlQ/CvCtCeNT2Q0A1W3Hofo21tCIdxliaTF8IK0GbQ== X-Google-Smtp-Source: AH8x224VDlYemC4EsIT8vCg6LPnpOWNxn8dReNmN6G81ynOzEeHkEAPc+amo7i9LzX9nKzr/47pzcUd+499MP2DaCko= X-Received: by 10.37.134.197 with SMTP id y5mr3467432ybm.129.1518622809893; Wed, 14 Feb 2018 07:40:09 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:ce89:0:0:0:0:0 with HTTP; Wed, 14 Feb 2018 07:40:09 -0800 (PST) In-Reply-To: References: Date: Wed, 14 Feb 2018 09:40:09 -0600 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="089e082600ac21afa605652deddf" Subject: Re: [PHP-DEV] About assert() From: tendoaki@gmail.com (Michael Morris) --089e082600ac21afa605652deddf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable My earlier reply was through my phone. I've since read the bug report and saw your note where you couldn't reproduce it. Assert is a statement in PHP 7. Try this code function foo() { debug_print_backtrace(); return true; } assert(foo()); In PHP 7 only foo() will be in the backtrace. In PHP 5 assert will be listed as well. What you are proposing has already been done. It's also why zend.assertions has three settings: 1: on, -1: off, 0: emulate PHP 5. Unless you have code on your hands that is breaking when the -1 setting is used, the 0 setting should never be used. On Wed, Feb 14, 2018 at 7:43 AM, Pedro Lacerda wrote: > The same beharviour, but `assert` as statement also uses 1 character less= . > > > Em 14 de fev de 2018 10:13 AM, "Michael Morris" > escreveu: > > > On Wed, Feb 14, 2018 at 1:16 AM Pedro Lacerda wrote= : > > > Hi developers, > > > > Trying to resolve the bug #75950 (that after long hours I found that I > > couldn't reproduce), I observed that if `zend.assertions >=3D 0` the > > generated code inside `assert()` was indeed executed even if > `assert.active > > =3D off`. Naturally the function arguments were evaluated before enteri= ng > > into the `assert()` function. > > > > https://bugs.php.net/bug.php?id=3D75950 > > > > The point is that will be possible to fully disable assertions setting > > `assert.active =3D false` after initialization if we turn `assert` into= a > > statement. This can mantain fully backward compatibility. Calling > > `assert_options(ASSERT_ACTIVE, true)` or `false` after initialization > would > > fully enable or disable the functionality. It seems the most sensible > thing > > to do. > > > > By the way `assert` in Java and Python is an statement, and in C it > isn't a > > function. > > > > So my question is what is the purpose of mantaining `assert()` a > function, > > there are any drawbacks of fully disabling it when `zend.assertions >= =3D > 0`? > > > > > > PS: Strange that nobody cared in recent emails about the proposal to a > > small increase of the testing coverage by doubling the testing time > > duration, was somewhat interesting. > > > > > Assert.active is the legacy PHP 5 control. Don=E2=80=99t use it. > > zend.assertions -1 has the behavior you want. 0 emulates PHP 5 and > earlier=E2=80=99s broken implementation of assert. If you don=E2=80=99t h= ave legacy > software to babysit, don=E2=80=99t use it. > > > > > > --089e082600ac21afa605652deddf--