Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127257 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 B64F21A00BC for ; Wed, 30 Apr 2025 20:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746043862; bh=4hRQ+qXwX8NY5bD77maoZORfc6UN15d1A9qT2eW+HLY=; h=Date:From:To:In-Reply-To:References:Subject:From; b=FC5Kuy2LekvlGZWclFskCToE2wtiV0qRM+Bx5u2kfum6P5wzuMoI55h2tXFNZnRt3 wnduNXG0w/CE3HHOwA/w9WwCEYLqrFkePESwp2WurJZ8MKEhgcTjPamC3WqRVVkx+b gG9WEwodJ/qZPXW4atfs9qWlnqS2BIA+Pmm54nnz72/3aGolaKNWEBdFCnPCtxYLNx AgCJbmT3SmAcp8tNCPPdk4NJ75+WRVziFQzIK5FbJKOKh7Bw9NOQ3pEr7WxMI/Tbgf Kd4pzYiBFsh3o5To9ai5wby5F0A4/1udXgm8jxGbkfhOuj3P5xQ69sa95FjYCrw/8X na2VnK3qspwsw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E337318007D for ; Wed, 30 Apr 2025 20:11:00 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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 fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (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 20:11:00 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 49E831380184 for ; Wed, 30 Apr 2025 16:13:16 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-10.internal (MEProxy); Wed, 30 Apr 2025 16:13:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1746043996; x=1746130396; bh=/lmj7KumlLwsJjrUxrwbO y/xUW9gPTvx4vzFtQuTmhw=; b=TG83eGqpnDmSM57vwCTe74b96zt2L2rOPth/K 6VkbFxKFohoGjLeJoxm/1TUWlPFG3EeG2oCYM+vuQ20ScAX4DwahLtps6ITl2ipa 8nOvvkcGRYQWZDdDYFgrxhmE3J7IKJX3S2uEkEeoyRCwa/eX6bQZVutz9a4jH77u E2bKsB6Pt9Ou9wXGX0RV9GxHsxqJDnOCwi0Rwze/nWr6dRKKlKJT27CPKSi7AZZT kUZ8l06yMfyG+R9sABL6VbXjp5VdKCQOCCcDzOqySv92E9XnE/eDmijerwCNtNsx RlB3eHtMuobC7fKz5K1dyTuhP58lEYvgmlQRJd/55UtDhYFfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1746043996; x=1746130396; bh=/ lmj7KumlLwsJjrUxrwbOy/xUW9gPTvx4vzFtQuTmhw=; b=GZBhEey0KNRGulWM2 YkGBJg3Xmvw8laRHTZ0+11sGo0MD00brATE7p9125hpWmbgpFtg+swSVX6+HZepJ dmD7AIiEGobyvkNoerdwbkdRtRPFTcb5IgYyTEXCGX7XUpnGuYD3Rzh6ZBsuH0yM IMyHgVXCb+8vTHSoJXxi6kmU+x/j4oIxGsNGgMF0Q6IvI2vJaon0qRvRk5ls5VUv IcGS25nTq4P+2mEiGRfFCdh4VveWL9oGyywwtP56t/hD1iOOWQvD7FrIMfw2/+QF f8yOVNojYlOXEPOKK/D+RiIlRk8Sbemy6NrKTHGPWwtLSntC+hhgCPegfClx9SOY XBE+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieejieefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthhqredtredt jeenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeffieeivdfhvdeguddt tdegteeiueegvefhteehfeeffeetudeitdehtdegjeeuieenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DDC0329C0072; Wed, 30 Apr 2025 16:13:15 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T3339c68d3b5f96f0 Date: Wed, 30 Apr 2025 15:12:55 -0500 To: "php internals" Message-ID: <36830fef-1594-4b19-8833-62aeb6a36389@app.fastmail.com> In-Reply-To: References: <4233b00a-7593-e70d-f235-da650cd7bac6@php.net> Subject: Re: [PHP-DEV] [RFC] Throwable Hierarchy Policy for Extensions Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Apr 30, 2025, at 1:06 PM, Tim D=C3=BCsterhus wrote: > Hi > > On 4/30/25 15:33, Larry Garfield wrote: >> The only time I've seen anyone use $code is in TYPO3. Their coding s= tandards say that any time you throw an exception, you use the current t= imestamp (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=20 > exceptions having different codes, just because checking the error=20 > condition is split across different `if()` statements for readability?=20 > That doesn't seem like a good idea - and that's why the RFC uses =E2=80= =9Ccause=E2=80=9D=20 > as the wording of choice. Correct. There's 400 `throw new InvalidArgumentException('...', 1234567= 98)` calls across the code base, each with a unique code number timestam= p. I didn't care for this approach either when I worked at TYPO3. :-) My p= oint being that I've rarely if ever seen $code used in a constructive an= d useful fashion. >> [=E2=80=A6] just that it's the only time I've seen $code used in the = wild... >>=20 > > PDO (for better or worse) also uses the `$code` for the error code=20 > returned by the database. Unfortunately it also widens the (untyped)=20 > $code from int to string|int, which causes some issues, since folks on= ly=20 > expect int, since Exception::__construct() types the `$code` parameter=20 > as `int`. > > Best regards > Tim D=C3=BCsterhus In my experience, worse. But that's another topic. --Larry Garfield