Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127215 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 0460E1A00BC for ; Sun, 27 Apr 2025 21:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745790168; bh=UVpUDg/NDiPNrY9YvuNHzQuQ+ZaGa/ycAjvklg2yvvk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JJ3roiUQcs+7epyNqAMIEi+xxCV4YzXUvRPZSwjd+D4fZaR9qSNU3QersuHpTLIcz /Ricgn/AaJb0AvT1Pgys2OYj1Cjv+AA4blxA8YewFoJaNU508KVH07lyVtu6Gp/lR2 g/gRlo6t2DWvcMF+D0iIu1G8niVCTjoxFst2fgNdGACUJ1AIpOG0CzNzN86jCEtzli eeLPxMklb3+8ol711X9A9gS1h2UsW4bjVKK8BTSTuC2BEeQQZAtCSsR3vPDEByaVMn W1BiUlJuXGpY6DT209hog3qh53TvNxLo/kNzNzd/9uwgx4xelzWSBvhDYzvNKndIpV EwGDwsUu/qCAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6C23A18003B for ; Sun, 27 Apr 2025 21:42:47 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS 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 chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Sun, 27 Apr 2025 21:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1745790303; bh=c8BBWpeR8DO7Unr5d+rTD15dx7U+EOfNJttbLrP/OF8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=j+Aj3WTyQMCuqKo3+8+FxS8EzQ8ex8U5KKpQ5iC3dMUPk6l/oo5e05YiXr4gGcgwF +hP+GJktUl5nQkQ8JIj1VoCqqtCUKzr6EncKbtJdWCQ34xqo5mePtZf03E3P22lQ1h R0veho5zNyFFF5N5lHZ0yZYY55P+NPi2CVK+lodp4QB/x6HYZuDfa3Zhc2iGNlCdRk h+xIdJBXDhjjM/LErBj5Zphwgy0w9dcy3ZDWwKfbHbg9YMvFDHzgtp71unkROCNmiX n8e4P1+fT5bgaEHWr/x5OpxJAGq3qUlMovhVH8ZQ5xNV60nGYJyQCHFNoVPs7ifA3p PFx2MS4oSaNQg== Message-ID: <8c35314a-e307-4018-8685-39d7a7923cbe@bastelstu.be> Date: Sun, 27 Apr 2025 23:45:02 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Throwable Hierarchy Policy for Extensions To: Kamil Tekiela Cc: PHP internals , "Gina P. Banyard" References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 4/27/25 23:16, Kamil Tekiela wrote: > The exception message MUST NOT be the only means of distinguishing > exceptions. Any two exceptions with different messages MUST be > identifiable either by a unique exception class name or code. Thank you. I have used that as the basis for this change: https://github.com/php/policies/pull/17/files/7f7bb9bd09f3883bd13a70d7f61abbc62bfe04a1..dd507261a61cf088d07d9bdca80d91dcc54daf8a I've intentionally adjusted the wording to "different cause" rather than "different message" to avoid defining what constitutes a different message. As an example, when the CSPRNG fails, we might want to emit different error messages depending on the CSPRNG driver (e.g. /dev/urandom vs the getrandom() syscalls), but it's not useful to distinguish these cases with a different code, since the user does not decide which driver is used and can't do anything useful with that information. Even distinguishing between "/dev/urandom does not exist" and "/dev/urandom exists, but is a regular file instead of a character device" probably is only useful within the message itself, since neither is really recoverable from within PHP and allocating and documenting codes is likely work that helps no one. Best regards Tim Düsterhus