Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127190 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 A8B4C1A00BC for ; Sat, 26 Apr 2025 20:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745701042; bh=DRvu1MpCByi159AIMzclnQoNkFGFf409/EazlenhnUY=; h=From:To:References:In-Reply-To:Subject:Date:From; b=mzlxp6cdNWCLFl1ZlUeWuI0mfTu+aCL5E8jG5kceYNLz01QfOMsWr2WtX1qFb3bx4 FwpPhSDz44pWROdJCGrrCavztSDGhepAOUx5WCiIRC4Vx9NQhUPfo4VEanSbd7EAYG bpdqsxPYUeA0n98rY2XhBLHSpH0kzopl64Uh7p15F8bMYIzeZC6a/tww6w2ZmpQtHa jwyq2zniOI9bZf5ul7bGyzq+BAtq9qZYpODmilR19S+b63PKTHYG4FYmRFXxqwcauE Z8xBoK6397T94JGHK357NjJb667nSoCu9al8Aq3zImqnUD2+luU80H2iDrCNoaJp2q p/Hmj1UDzMDMA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 622EC180052 for ; Sat, 26 Apr 2025 20:57:21 +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=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_PDS_PRO_TLD 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 slateblue.cherry.relay.mailchannels.net (slateblue.cherry.relay.mailchannels.net [23.83.223.168]) (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 ; Sat, 26 Apr 2025 20:57:10 +0000 (UTC) X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CE278782C1C; Sat, 26 Apr 2025 20:59:26 +0000 (UTC) Received: from server52.areait.lv (trex-6.trex.outbound.svc.cluster.local [100.106.221.95]) (Authenticated sender: yszpovajlk) by relay.mailchannels.net (Postfix) with ESMTPA id 02A7B782A55; Sat, 26 Apr 2025 20:59:25 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1745701166; a=rsa-sha256; cv=none; b=iDjLlBu9yVx9y8X/jlaeG4ts5vkD/5gu+k0YV8V0PXYEuXE1+77oT8HrvMStM3YWmhT0c1 KQTlMTeF4yMxHannyyBnScF8I6GBFheaGRk2cHrx6b4+5Ep3KXUHGSesoDCh7u8x826xAv RLZe7KfhZ/PJTrRwrgzD3upTgvSrFoeY9j6uGAtxiLm/SD8SRfL7m4RL0FtP/yRNYYAHVk GVrY/J6X5jxkfG7BlLvBAMFgtC1hoCCfxgECURaiPFOkvo+FTFYIQ2x8qTU6jtjtCMdrla SExmxX25q5YsqmmasX6Urq7E3KbSoErX4uoF5bBMWKB4cAZRJhpzYA2arc1mNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1745701166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CSyu0VCBta3e+UAKfM2284tZxs5BV04Hgm/XYX6t8hU=; b=XZEvRB3jVP7g2Bw2wb1sDsHa51FLiPMsbdj3KZNSfRsKJWG7fLW3ite7lEh0UeX2gaLg5e LHl9WuCaJBqCfd2pDehPcp2oFg/7WZPPUsyDRBJnhdX//dcnb9pOF4AOkjAhIdIv4tUWzA Up2jMOZSoYka2qcQKLrwmdhF9qC/OOytk4fcmeScDnC5KGfomqVNY1yVAVrNWET1SEvcHz 1JRBWQXlMxOj12uSTnbKh1n6QcAk3biWl3wqHf3XLWAEdB3BLusRpPsAHljbsYpq900smk eOMRxjji9k5zoDluCgk00KXZPnZXj8qOHOwYzDblBjEtCgQjuX1QNFolX921GA== ARC-Authentication-Results: i=1; rspamd-5b7d88665-m9w4l; auth=pass smtp.auth=yszpovajlk smtp.mailfrom=juris@glaive.pro X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro X-MC-Relay: Neutral X-MailChannels-SenderId: yszpovajlk|x-authuser|juris@glaive.pro X-MailChannels-Auth-Id: yszpovajlk X-Minister-Shoe: 5f966c2e76981cc7_1745701166716_2614177001 X-MC-Loop-Signature: 1745701166716:552151117 X-MC-Ingress-Time: 1745701166714 Received: from server52.areait.lv (server52.areait.lv [83.149.95.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.106.221.95 (trex/7.0.3); Sat, 26 Apr 2025 20:59:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=glaive.pro; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:In-Reply-To:References:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CSyu0VCBta3e+UAKfM2284tZxs5BV04Hgm/XYX6t8hU=; b=NJcePuzBBhbpMfYuaFiPUgVy5t utMVqN93cjUDrsO06xxvhBg4B3gwfjLx/2dLaWdK02bmhNuhpCCmMbKG0ZxgQdzWrYqSJLIsF39j0 xqV8PJy20DeRcPV36sy+khDFnXUaTglG43UhQbPeLwdg7dLAFYLd5U0hVhCmxnN32zUQffpVkVy/V l3Sglyux/YcfxWxDPpUY7sROVnoUfC8n3gvGGJh+XAmqq7yIYOV0yAeRD9nnmxe/Lts2R5xv5xVq0 fxGaskCf+suRDd52/0j/ysuNyS5vsIILNxbUCvbDPy9mjKn9hiPGf90KgjtNk5/FDG20QWNovQXaz usk40yDA==; Received: from [77.93.29.116] (port=49837 helo=LAPTOPHKIOPCGI) by server52.areait.lv with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1u8mcP-00000009u2t-1JvO; Sat, 26 Apr 2025 23:59:24 +0300 To: "'Larry Garfield'" , "'php internals'" References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> In-Reply-To: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> Subject: RE: [PHP-DEV] Concept: Lightweight error channels Date: Sat, 26 Apr 2025 23:59:21 +0300 Message-ID: <003901dbb6ee$15dc1c60$41945520$@glaive.pro> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQE9iLLDxgfK5qblVycG2tAV8maICrTyw7Kw Content-Language: lv X-AuthUser: juris@glaive.pro From: juris@glaive.pro ("Juris Evertovskis") 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? 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? function div(int $n, int $d): float raises ZeroDivisor { if (!$d) raise new ZeroDivisor; return $n/$d; } function inverse(int $x): float { // does not handle the raise return div(1, $x); } // assuming the above functions are in a lib, can i rescue this using some trycatch or not? inverse($_GET['x']); And if I don't rescue, am I supposed to see that I passed a bad value to `inverse`, a bad value to `div` or just that `inverse` failed to handle a raise? BR, Juris