Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123291 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 002DB1ADBD4 for ; Thu, 9 May 2024 15:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715267984; bh=HagLKP0l/05SVXo/hN3aHofE6XgPNaW+m5zsMWYv9bA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=ZjdMaVdhRWE8taHAD4ndAIL5CBHRJMHvs2gXxUXdlmGovuHMOmDH7U03iEBIeNUmD jmYsFkb8o01qfYS+MfibMaF7ooyM+0GNN7Asa9x1eo7YgpUmCXo+dvwYNp3B2j/3b/ /nE9gTMB4N/TalwjTCo715o8nmTFcqwLFZRAT+80lutatsTGlHnL6wmjeXDxCKbAYo dCILLMBdwOjs7BxDJwEf/PcNBntN3lzwd4rxZJj7J+FLtzq1SUTjDkXX6lp38eDhwM yF58bQkyisl1GNierFPQP1AprBO/8PMwQJKk3hnztslaMxYjZyLZulTCoBR6jn8kjK Pbq0KD7knaWWw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0D128180578 for ; Thu, 9 May 2024 15:19: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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (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 ; Thu, 9 May 2024 15:19:37 +0000 (UTC) Received: from smtpclient.apple (unknown [117.55.37.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 537824012C; Fri, 10 May 2024 00:18:46 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1715267926; bh=HagLKP0l/05SVXo/hN3aHofE6XgPNaW+m5zsMWYv9bA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=LMxmAYeFVL0klbMPPGcDJZElC/unIrdPnUCRqqakDiZtwTySFpu/FTJIhimh9mLnI Vv08mrD9rNTDPRP96H/iZnTlaDmlQsSBDj/VG+Xp4Rnv2Chs9MwTAcPeZHUf/To1pK 7uNo6oDr62MTGuBnLZ6OFpQAb9xVbOLBZ5LmvIcM= Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) Subject: Re: [PHP-DEV] [RFC] Transform exit() from a language construct into a standard function In-Reply-To: Date: Fri, 10 May 2024 00:18:33 +0900 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: "Gina P. Banyard" X-Mailer: Apple Mail (2.3731.700.6.1.1) From: saki@sakiot.com (Saki Takamachi) Hi Gina, > Hello Internals, >=20 > I would like to formally propose my idea for exit() as a function = brought 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 = the transformation from a "constant" to a function is done at compile = time and 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 I generally agree :) 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 = that this may lead to data corruption and personal information leaks due = to unintentional data being inserted into the DB. ``` try { exit([]); } catch (Throwable) { // } ``` Probably no one likes to write code like this, and even if there are, = there are probably very few, but code that is written with the = assumption that exit will always stop processing may be a little = dangerous. Is it nonsense to always stop processing even if an error occurs? Or, = how about creating an uncatchable exception class specifically for = exits? Or is this level of risk negligible? I am writing down the ideas I came up with, so please excuse me if there = are any mistakes in my understanding. Regard, Saki=