Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127255 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 lists.php.net (Postfix) with ESMTPS id 0F62A1A00BC for ; Wed, 30 Apr 2025 18:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746036275; bh=7+JUdZYjFiffVkxWB98YLKJqwyHZK17zd4NtinZx7XY=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OusdHs5Fpq/iWj0/DlFrKOWf8RJMh7+PaQKSVPTwgI2j/yOMKtF/8/wxp1dfq1F8q bzSJxDrBtq3kn4PrYG1LcofrBvh39+G8L4+k4ZmMSAAGWCEjEv7bf/5ybkSMdUnxDs 4dDt7g6Dki41qoouVAK8UITyPC8VddKcnOg7ER7DuuUfyKtZTpCaWBow32LWJbJS3K Ge1OBNtqNsKHBMixm17suTZ0fTPz/7VgUF2sV3TIevRveWigovM6LYuwPeC7YB+m2z 9TfV29cPnxxiOAzO0+sITTM1V+e9JYlWp8YfzCp4aWz8/TDpTVC4p6F0kKDgkHrGjv CE1O41+T0BjvA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 84CAA18002E for ; Wed, 30 Apr 2025 18:04:34 +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.7 required=5.0 tests=BAYES_05,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 ; Wed, 30 Apr 2025 18:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1746036398; bh=0B0/iYp1rb5wempB+TJK3MRMK4OF/6Hs6089ojcssH0=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=CgQyo9oK9KckMvZAsVK8j+nDcGFNNCXaGWhFouKIn46swXlgjhkYepGp9zH20vx5U txNIwP0c/4Cnhg8SSaJWiGR8V96/tkmh/2LBhrcV0o5/cOduQjML+gC+zIJxqaI6UQ IioH47pXvChC20IAoAwharnI2ETKVrSJHj+dx8fuPSJBdlXp5kJsdvsEk2ThZRi1CF FtWbMvgK7bGAA0PBxYnBPqIM+jhI3vpZEXblSFu+1JRLyI6Y+om3hagqs/TEdGndSj 0N4dueheP1xphWyxvdl6ptyJAEcceCvr/cHZ5lWBD0eUxC5SYzxu7suf32bf3PZji6 t0UvUEqxAKndg== Message-ID: Date: Wed, 30 Apr 2025 20:06:36 +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: Larry Garfield , php internals References: <4233b00a-7593-e70d-f235-da650cd7bac6@php.net> 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/30/25 15:33, Larry Garfield wrote: > The only time I've seen anyone use $code is in TYPO3. Their coding standards say that any time you throw an exception, you use the current timestamp (determined manually) as a code. That way there is a globally unique code regardless of exception type that can be grepped to find the exact line it came from. To my understanding this would result in effectively identical exceptions having different codes, just because checking the error condition is split across different `if()` statements for readability? That doesn't seem like a good idea - and that's why the RFC uses “cause” as the wording of choice. > […] just that it's the only time I've seen $code used in the wild... > PDO (for better or worse) also uses the `$code` for the error code returned by the database. Unfortunately it also widens the (untyped) $code from int to string|int, which causes some issues, since folks only expect int, since Exception::__construct() types the `$code` parameter as `int`. Best regards Tim Düsterhus