Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124814 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 9FE951A010C for ; Tue, 6 Aug 2024 19:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722971366; bh=UgyRir2PP3vurv730S26NYXp/ScjlsFL6pfmLseD6vs=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=Hx4ZTEKCKzEt7NLlBNU40m39ECH5Ys5zUownjmbrvZlviNoJxwItrg/HBbNVj+dPe +tbNiTFLhfRwDzfyAyCyRtGGJZXqXIqhebNfDxpPifHcyzp5b7yctwACpoFBE/MqUy /GwiRinbNGjShGrjTL7BjxlbgxaMxiu/AqVyp67bcIp1KlQiBw1IoepoZdV47cY+JP vXwVKaSJRC1KYy790JM+gUlNbnFzsclSxoK1uTIDZvZrw4eAYRinl5RnHzGBdkW13R lNqYfhETsBiwKw4qBW9rrKtgaLZRrOHXnP3gJCz1r7v6EBnfdJwo7hYIIku++YLa7p jx5yrp4kh9+KA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A28571801E5 for ; Tue, 6 Aug 2024 19:09:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 6 Aug 2024 19:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1722971257; x=1723230457; bh=UgyRir2PP3vurv730S26NYXp/ScjlsFL6pfmLseD6vs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=omZsbnUkTwQXJQcYe3+9PCN+7yMZ+gXRVb/9i7ezzZpeM5WQJourwV7Zsi+tAZx8g fyVwaMjbrt6WM3G2rIVTr8jkRyTtcuTHhOBTAl4sfMXr0rJ03NbSDafWq4PfOQUW92 4p+Q+wWs9ZhNdr5c990DMuX5ctvKst80otG3l/4/ss/Te4SK/4aPxhhLjbbZmhftGu xI+FlTl628Bc4TVl4uJug+Y40MUDFyht8M9uReJFHNO5PHuVgKpi9t4LNVPOx9zBe8 KeQUi3BgePtLIAxERGzLkFeqz+bWQlvMOIaa4e0XAgZuekUeFLBxnwtPk+M+v+kOQ6 EqxDOlqBkK8jQ== Date: Tue, 06 Aug 2024 19:07:34 +0000 To: "Christoph M. Becker" Cc: =?utf-8?Q?Tim_D=C3=BCsterhus?= , Derick Rethans , PHP internals Subject: Re: [PHP-DEV] [RFC] [VOTE] Transform exit() from a languageconstructinto a standard function Message-ID: In-Reply-To: References: <15bb76a0-cbd7-4145-b429-76d424755106@gmx.de> <1a8650d2-7eb5-d645-8132-e5522ad24637@php.net> <06ba1d82-6387-46ac-8be3-1d3472993e1a@gmx.de> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: cbfa51b5d158967a1defb725cb99441669e684a4 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Monday, 5 August 2024 at 23:55, Christoph M. Becker = wrote: > On 05.08.2024 at 21:37, Gina P. Banyard wrote: >=20 > > This sounds like a uopz extension issue that is easily fixed. >=20 >=20 > Most likely, yes, although still somebody has to provide a fix, and > someone has to do a new release. Why should I investigate time to fix extensions when this RFC might not eve= n land in the first place? We do countless engine breaking changes without RFCs and without notices to= extension maintainers other than UPGRADING.INTERNALS. May I remind everyone that PHP 8.1 had a huge breaking change for extension= s in utterly rewriting the stream API: > Zend Stream API has been changed to use "zend_string*" instead of "char*"= [1] Extension developers have somehow coped with it and/or just suffered in sil= ence. We didn't provide ANY help for extension developers to make the move easier= . It is getting frustrating that on one hand we treat extension developers li= ke they are idiots incapable of updating their extension for minor changes = in engine APIs and behaviour (or even just including the proper headers cir= cling, back to *that* whole drama) While at the same time kicking them in the face with massive, and potential= ly clunky #ifdef checks, code churn for major engine API changes that get Z= ERO discussion and expect them to be competent at their job. Could we maybe start respecting the intelligence of extension developers? And if not, can we stop pretending that we care about them when we, as a pr= oject, clearly don't seem to care in our actual action? Because I find it a tad strange that every time I point the above stream AP= I design change, the only thing I hear back is crickets. >=20 > > I am not sure why we should bend over backwards for extensions that all= ow to break usual userland semantics while preventing userland behaviour to= be better. >=20 >=20 > We shouldn't do one or the other without having weighted the pros and > cons. So what are the pros regarding improved userland behavior: >=20 > * we can use named arguments >=20 > So we can now write `exit(status =3D 1)` or `exit(status =3D "some error = message`). I don't see any improvement using named arguments for a > single argument function (maybe unless it is a boolean argument). And > for a string argument, I don't think that `status` is a sensible > parameter name here. Please propose a better name then. >=20 > * pass to functions as callable >=20 > That might be a nice feature, but at least I have never seen the need to > pass `exit` as callable. And it wouldn't be hard to define a wrapper > function (e.g. `my_exit()`) if someone really needs to pass it as a > callable. The fact that one might need to do this workaround is bad already, and not = a justification against this RFC. =20 > * does not respect strict_types and does not follow usual type juggling > semantics >=20 > That might be an issue (although I've never stumbled upon that), but > it seems to me that this could even be handled in the ZEND_EXIT handler. Now see this is strange to me, as I clearly remember hitting this issue whi= le working on a QA scrip for the PHP documentation, was not understanding why CI was failing with no output, until you realised that the issue was me passing a boolean to exit() that w= as being cast to a string and not the expected integer. So I would argue you have stumbled upon this. >=20 > Perhaps I've missed some pros, but it seems these have been the ones the > RFC explicitly mentions. >=20 > So, what are the cons: >=20 > * removing the ZEND_EXIT opcode >=20 > That immediately breaks any extension using it. A quick Github search > lists 3.1 k occurrences[1]. Please see point about the stream layer API change. >=20 > * making exit a "proper" function >=20 > It still can be called without parentheses, so I don't regard it as a > proper function. It might even be confusing to readers ("oh, now I > can call a function without arguments by omitting the parentheses = =E2=80=93 but > why doesn't it work for other functions?"). And the PHP manual even > states (emphasis mine): >=20 > | exit is a language construct and it can be called without > | parentheses if no status is passed. >=20 > Weighting the pros and cons is left as an exercise to the reader. >=20 > [1] https://github.com/search?q=3DZEND_EXIT&type=3Dcode Since when has the documentation been the normative aspect of PHP? We routinely fix the documentation to explain the Zend engine's true behavi= our, even if it doesn't make any sense. This sentence is true as of now, and may be changed if this RFC passes. Using current wording on the documentation is.... a strange argument to me. Best regards, Gina P. Banyard [1] https://github.com/php/php-src/blob/PHP-8.1/UPGRADING.INTERNALS#L36