Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123311 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 139C21A009C for ; Sat, 11 May 2024 14:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715438803; bh=l7XwIncsXKS6PDsTggWy9wTSthGUvlTBIC6iNMOra9E=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=lt1P/tdKDj9v1l8Idu1DFXJUt78gYn7sEyxZVx7uVpP+vGhLCIbCfjaG+RmvpkGhP oqPgwh91neK34javbqzIwyyVdy5+x5ii5OnqUeuhY5Wx7R8Q9s0nf6Gqug2gMp6EAc cGazu/OxFekT9OQa/ylrLxMWsEwQ64AIu+VsrflYNis4bIPDZLoWVnJ168tACUVBRX ssGxKjTpB4pgvksopWj9LB8Jq1xTZOn0wqACgcK6jkC3CRThb45QxaKUXqQKYOf5Z1 apHoKzEWrxnXKKZhYWDDX+n+kGT8lq0lIdAQAbBH1K2kLKcySMoqe3q6LkQmTXuGlo QXvq79CPoXxzA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B9EFF180707 for ; Sat, 11 May 2024 14:46:41 +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_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 11 May 2024 14:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail; t=1715438747; x=1715697947; bh=l7XwIncsXKS6PDsTggWy9wTSthGUvlTBIC6iNMOra9E=; 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=JpZQCQEGHbw8dRIOYJb04b3ggDHv/1ipGCRQWZmhfOCsCj+RPjh/bsB9KIvfkj0To ztk5fZ+tpPXOSmQTwhwlg9tEzc7HerdboYhhaEcMaRWxbWJq78hcw6Y44lTz0UYN9p nAFOLAfZmxSDCaD8xg3yz2xfd8Bdrs4rsX1+7al4avydLo4ZPhaLTrtlf9UF4O9BG2 zqWaHNG2rPrGEfRiX1+26HqwDPwoR1Cy5SsFab2hKi9hmQby/L3B8R5wCPfCCT1Mmn gmL4C6QfD+sR3MkstUfK9RwsophAWwb/vxCIT8Wadp1Bf+gAK63Uz7hK+4UfIcwr7K 8gZGGcrGDwPHQ== Date: Sat, 11 May 2024 14:45:44 +0000 To: Saki Takamachi Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] Transform exit() from a language construct into a standard function Message-ID: In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: eda657c455c8814d9dc2689aca4135cc414a2c73 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Thursday, 9 May 2024 at 16:18, Saki Takamachi wrote: > Hi Gina, >=20 > > Hello Internals, > >=20 > > I would like to formally propose my idea for exit() as a function broug= ht up to the list on 2024-02-24 [1] with the following RFC: > > https://wiki.php.net/rfc/exit-as-function > >=20 > > There have been some slight tweaks to the implementation, namely that t= he transformation from a "constant" to a function is done at compile time a= nd we do not hook into the behaviour of constants any longer. > >=20 > > Let me know what you think. > >=20 > > Best regards, > >=20 > > Gina P. Banyard > >=20 > > [1] https://externals.io/message/122483 >=20 >=20 > I generally agree :) >=20 > My only concern is that if this function throws an error and I catch it, = won't it proceed against the user's intentions about it. I am concerned tha= t this may lead to data corruption and personal information leaks due to un= intentional data being inserted into the DB. >=20 > `try { exit([]); } catch (Throwable) { // }` >=20 > Probably no one likes to write code like this, and even if there are, the= re are probably very few, but code that is written with the assumption that= exit will always stop processing may be a little dangerous. >=20 > Is it nonsense to always stop processing even if an error occurs? Or, how= about creating an uncatchable exception class specifically for exits? Or i= s this level of risk negligible? >=20 > I am writing down the ideas I came up with, so please excuse me if there = are any mistakes in my understanding. >=20 > Regard, >=20 > Saki You can already escape an exit() call, either by setting an error handler t= hat throws, or by passing a non-stringable object. See: https://3v4l.org/vR3up Best regards, Gina P. Banyard