Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120698 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62789 invoked from network); 27 Jun 2023 13:44:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jun 2023 13:44:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5A3711804B0 for ; Tue, 27 Jun 2023 06:44:24 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 27 Jun 2023 06:44:23 -0700 (PDT) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-55b12286476so208256a12.1 for ; Tue, 27 Jun 2023 06:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687873462; x=1690465462; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Zew3I42S59Fx8PrFXqmdoSzqJzBDL9qBx1iS7cm/T3I=; b=paIHIeaVx5ncPTRLrpCLZ2s3YHgwTLLDHlGyuZSTJNAPn1c6SpfSG20mofX7+tBAmr Nm/tQMkPUjTRbj7l2l9pH43Z26k2UXZu1rlOUQeNY5EdOCDEJZujOlWNHPWXQybJzqwN SBy6Apzg/DETLJlIgqJV8j3DFZEE/QjpMF/yv3ymz/LI86V+bN1t9RYw1Beb19l69H2+ mbdZQbp3o77wsEhCELafWGMCtGuKITLNZFgJNbHx46x/KGFEp7tHRzRodLmMz4I+iJQj VxY0Q+2fLnCBZ38WdAaYT3wTQdj5zz/ON6+M5gshjWnRwOaaZ32Dv6xHJIp3M9ySRoiU gNaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687873462; x=1690465462; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Zew3I42S59Fx8PrFXqmdoSzqJzBDL9qBx1iS7cm/T3I=; b=CVp3kB5NyELumffeFAdukrVHXGohdpPbSyTB6uBdKUKXabYp3JHv/qhrMHgiNkt5J/ Pw2aF/tNUNw/sr244+v2AHMHqYqD2W8rFEfjFvNQ7NTCy1DpqGzxnmiKCCtshpV4cm2/ Je6Z+xD+zgB1thrOT1By+0Jyn6FJzcbYqVW30iki8vvS8IufwqTl0JBjzhEDhB5TkCW7 rIVPjcmkxT7TY1+6gODe2Bo3m4MJJiUIp53bEM62+XYJOJFhhReD789g8oOtIVoTPEnk mHoTfVpd/W++e9ymiZcH167R2soG8eBjT8tKr/8sxEtZL/0MH6z33ThYwjo0txYrpDwB Mx1g== X-Gm-Message-State: AC+VfDxqJx+RoiZnRk7dAFb1bER//tM6/dkiqdJea3vE9TFQdJ55BWE8 NUXN2xcVH1wt14oJ9vaOoK25cxSswlidu/LLOzQ= X-Google-Smtp-Source: ACHHUZ6eUaFy84I4KVZSjVtStn7fyG1bZ3vQyvFo9YUdpRseSkW8AutkjJrduqc+2dXrrtD3H5HV8lplVjfxa1/6zzA= X-Received: by 2002:a17:90a:8008:b0:263:1af0:5541 with SMTP id b8-20020a17090a800800b002631af05541mr1393634pjn.32.1687873461923; Tue, 27 Jun 2023 06:44:21 -0700 (PDT) MIME-Version: 1.0 References: <72F136AA-768F-4577-80EF-22212DB50EF3@gmail.com> <7C9992E3-015E-48E6-A816-0AD012CA5CAE@gmail.com> In-Reply-To: <7C9992E3-015E-48E6-A816-0AD012CA5CAE@gmail.com> Date: Tue, 27 Jun 2023 14:44:09 +0100 Message-ID: To: Claude Pache Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000001fb4f205ff1caa43" Subject: Re: [PHP-DEV] [RFC] Deprecate remains of string evaluated code assertions From: george.banyard@gmail.com ("G. P. B.") --0000000000001fb4f205ff1caa43 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am going to group the response from the 3 emails. On Tue, 27 Jun 2023 at 09:17, Claude Pache wrote: > Although the specific comment in the php.ini file talks about runtime > switching, it is in fact irrelevant whether it is set at runtime or not. > More concretely; I use currently the settings: > > * `zend.assertion=3D1` as set in the global php.ini; > * `assert.active =3D on` or `off` in my per-directory .user.ini or .htacc= ess > file, depending on whether I want to enable assertions by default; > * optionally `ini_set('assert.active', '1')` at runtime when I want to > enable debug mode temporarily. > > I have established the above settings several years ago (at the time of > PHP 7), after having carefully read the documentation (and having been > slightly confused by the redundancy between `assert.active` and > `zend.assertion`). I might have end up to switch between `zend.assertion = =3D > 0/1` instead of switching between `assert.active =3D on/off` instead; I c= an=E2=80=99t > say exactly why I chose the former option instead of the latter, but I > guess that both the comment in the `php.ini` file, and the existence of > `assert_options(ASSERT_ACTIVE, ...)` as an alternative to > `ini_set('assert.active', ...)`, have influenced my choice. > > Note also that the above settings minus `zend.assertion` was the way to d= o > it in PHP 5 (again it is irrelevant whether it is at runtime or not), and > many people that used assertions in PHP 5 may have continued to use that > way without modification, as there is currently no strong reason to chang= e > (only `zend.assertions=3D-1` is relevant if you are especially concerned > about micro-optimisation). > > Now, of course, people will adapt to the new settings. But given the > confusing state of the options (both `zend.assertion` and `assert.active` > must be enabled, and I am not even speaking about `assert.exception`), yo= u > ought to be super-clear (in the deprecation notice, in the php.ini file, = in > the docs), what is the the expected state: paradoxically leave > `assert.active` and `assert.exceptions` enabled (the default value) even > when you want to disable assertions, and playing exclusively with > `zend.assertion`. > I would argue that zend.assertions=3D-1 is more than a micro-optimisation, but that not the point. Yes, you would need to switch to toggle zend.assertions between 1 and 0 if you would want to enable/disable assertions at run-time. However, considering that code should behave the same even when assertions are not compiled (with the -1 value) I don't really see the point of toggling between both modes. The expected state is to leave all the assert.* INI settings to their default value and only use the zend.assertions INI setting. The state of the assert() docs were in very bad shape, and I hope that my recent changes to it has improved it and made them clearer. However, I will make sure that the path forward is very clear be that in the INI setting docs, the assert() docs, the assert_options() docs, the migratrion guide, and in the deprecation message. On Tue, 27 Jun 2023 at 09:37, Claude Pache wrote: > I don=E2=80=99t see the RFC listed under https://wiki.php.net/rfc#under_d= iscussion > . > Fixed. > The RFC is imprecise in what is meant by =E2=80=9Cdeprecating=E2=80=9D. I= guess that a > deprecation notice (E_DEPRECATED) will be triggered at least under the > following conditions: > > * at startup when one of the assert.* setting has not the default value; > * at runtime when `assert_options(...)` is used; > * at runtime when `ini_set(...)` is used to set an `assert.*` option to a > non-default value? > > It is unclear to me what will happen when: > > * `ini_set(...)` is used to set an `assert.*` option to its default value= , > either as a no-op or not? > Clarified. > Moreover, by removing `assert.callback` (and other options), are you > effectively removing a feature? (I don=E2=80=99t really know, I have neve= r > considered it even in my worst dreams.) If so, it should be noted in a > =E2=80=9CBackward Incompatible Changes=E2=80=9D. > Yes, I don't really see the point of such a section as a deprecation, and thus removal is clearly a BC Break. I have tried to improve the wording to convey this more clearly. On Tue, 27 Jun 2023 at 09:47, Claude Pache wrote: > changing the return value of `assert(...)` from `bool` (true) to `void` i= s > also a BC break, (and it is unclear to me what is the effective advantage > of the break). > Considering that any failed assertion is going to abort execution, having it return a value is pointless. Moreover, one must not rely on the expression being asserted to be executed (thus it should have no side effects) and changing it to void very clearly conveys this meaning that one must not store the result of the assert() as it is not a totally normal function call. Best regards, George P. Banyard --0000000000001fb4f205ff1caa43--