Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127192 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 45CE31A00BC for ; Sun, 27 Apr 2025 05:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745732433; bh=amuZOjBnf6iKhvj0d0hynYhntyJegAOG8M++Ai6BvqY=; h=Date:From:To:In-Reply-To:References:Subject:From; b=AY92lOUT4yebr9WnSwHsrY54bMUY4kklMkHY8SyOFCbAuoWDWBiXo7sfYXYIq6dn3 wmg+vV/BNgr97fFpm/VeciRvq/5ESKkZsqYEabZ8lJCRHTfhHTrfrs/hmRUpEKaBMY FgDtUWNw3Qi38ufDFhXmQA7B9EDK5gwXvcv/QRR+5d9+ASuYB6b6BteowyvtJQVacN CJp6BsltNOlFt81YF1LS8xHML+tIINxEXpVhqNuOozVP/bLAVPfVxu4E58Ib2K1c9j EJfRqqNta8/cAUnFTDEGReQL/OCh2CcT1tNYqORcLif3wPZ5oFmr+gSqIjnsgfxWh7 2nbM4GE1Xf1eA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E5A06180081 for ; Sun, 27 Apr 2025 05:40:31 +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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 05:40:31 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id E357C114019E for ; Sun, 27 Apr 2025 01:42:48 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-10.internal (MEProxy); Sun, 27 Apr 2025 01:42:48 -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=1745732568; x=1745818968; bh=EuL3i+o+FqGn5dVHJdotd 3ND6O/XTliro8HFVnXJFR4=; b=hWiDIYnJ8qw9QEbxWUO1RhxhBSUva+QRk4++q D3NgJ7oYndidRl/DLwstjFF9OsC7tenDtuxgUK5pHEL0SLsu9bbGgtH6S9cZhlck o+5sXQTK9CJF1r45CY5bv8zcIHxeRGMeoSoADY6HA1c9SABkqMW+qMSFvwxDJtwK 1gZsjxDJgfahx1wKmk4wybG22O39kVFSzaWfh04sFg0bWHX66QxudrFO7s3uuNGw zPZcUUD9ZcCLc0eyikJs8UwZU56HKkNI7rSnhEGeAZOsCRxEUoqIKcT4Dl/lXYj/ e3nx2z33tdJEIBxVGrckLcIE7OmqpGaUHo57/WuByklSizDpA== 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=1745732568; x=1745818968; bh=E uL3i+o+FqGn5dVHJdotd3ND6O/XTliro8HFVnXJFR4=; b=CU/hedJFZjGCqfkCp WkWIhTQBwRqCQx5lfbpJOvb+IT8Lh7qn6AMtpDJaVdC16X3GuLMgEHNz+2jmxLuV BGo2PM1vHhM50vdWCkluh5HcBR+FmXPAjBjbUHCdXh7ezuxKXE3polfniQWfNVTW ZUAxW1EDKcoPIL+pN/G5jA7/44YepQbDXjBeTIvYcg2ICIW4yDjY5eWOmBCW+HQj ar4uYclRN6ulKc9EWTk0nK3/wbR3zfFdgWvhy/HPC0f++EB+mJRQpVySu51usr3b YhQUGsxt0NxqJeTepqNsucoet0fROJryMDYe50G0U08ysEUtv3cEdU0K3KR4RQoC KMKkw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvheejvdeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthejredtredt tdenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpedugedvlefgueegheef jeetffduveeltefhfeegjeffffelgedttdevkeegkedugfenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 9721229C0075; Sun, 27 Apr 2025 01:42:48 -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: T7e0f24752af1ea38 Date: Sun, 27 Apr 2025 00:42:24 -0500 To: "php internals" Message-ID: <2a2fef34-d610-4f6a-9c7d-16c98c724c83@app.fastmail.com> In-Reply-To: <003901dbb6ee$15dc1c60$41945520$@glaive.pro> References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> <003901dbb6ee$15dc1c60$41945520$@glaive.pro> Subject: Re: [PHP-DEV] Concept: Lightweight error channels Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Sat, Apr 26, 2025, at 3:59 PM, Juris Evertovskis wrote: > Hi, > > Reading this as a PHP dev is confusing (terminology-wise) because errors > used to be the fatal ("stop the world") conditions while exceptions were the > catchable, recovarable issues within some call - feels to me pretty > equivalent to what you're proposing here. > > What's the problem with PHP exceptions? I'm not even trying to argue, I'm > trying to understand. Is it the implementation (bad/expensive performance)? > Semantics? Handling syntax? There's two key problems with exceptions as PHP currently has them: 1. Creating and attaching the backtrace to them is stupidly expensive. It's one of the most expensive things you can ask the engine to do, I think. 2. They're unchecked, which means as a developer calling a function you have absolutely no idea what exceptions it might throw without reading every line of that function and every function it calls, transitively. That means it's extremely easy for an exception to kill the process if no one expects to catch it. What I am proposing is something that works somewhat like exceptions, but without either of those problems, to handle cases where the immediate caller is the obvious responsible party to handle the error case. "Heavy" exceptions will continue to be useful for "the database caught fire" type errors, where crashing the whole system is reasonable and it's just a question of how to do so gracefully. > I didn't understand the bubbling changes either. What do you mean by > "fatal"? Does it turn the raised "light error" into a real exception? Or > does it turn into an actual error crashing the whole process? The details here are one of the things I haven't thought through yet (hence the point of the email, which is asking "is it worth my time to think through these things?") Most likely, an unhandled raise or an invalid raise would get converted to a thrown Error of some kind, which would be handleable like any other Error (which is generally "log and then crash"). That situation would be a "the developer screwed up" bug 100% of the time, so a thrown Error is the correct response. --Larry Garfield