Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128344 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 357D21A00BC for ; Thu, 31 Jul 2025 13:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753969501; bh=PsHLx5GXRpdYOfw8C7B2la/HHyqr7RS/XOCUVCfThFc=; h=From:Subject:Date:References:To:In-Reply-To:From; b=BAs8omSNzC2Kfldtgrimd+fZNpmSP/hvF4Q3L/dWklVKdMWJ8OydP2N6Jo1MU2+ml 7CfqxfvweoyspWvNTraECneaoBfIsInGJZ1uKQjZn2QF1J6XPCIsL/JFhdpjW90z6H XpVlMIzyCQIreFzBLq5G0Rws3FKEPH32VX/Bi2eVwF0EXQS2GCb4RaQksEiZkDlGTL pkd9OlAPGzLvk7vSpf4saiuMOxv4TaBoz5RUSfK5e4MrCc4XfFtfp9L97SqW3Z34Te ND4lsOVwEQF25HSmbTpPTXoFr3f3N9S150PxawpjYkAR5hUsSstaUK8b7t87aUlWtU qGAkMGM9cPqOA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6425E1801EB for ; Thu, 31 Jul 2025 13:45:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,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.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail.gna.ch (darkcity.gna.ch [84.234.28.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 31 Jul 2025 13:45:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.gna.ch (Postfix) with ESMTP id 0BB552381829 for ; Thu, 31 Jul 2025 15:46:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1753969602; bh=PsHLx5GXRpdYOfw8C7B2la/HHyqr7RS/XOCUVCfThFc=; h=From:Subject:Date:References:To:In-Reply-To; b=KJZXtAJ2KXoKglPFyQGoHfJIBnVnWdBNp2CYFk1srFyDqmmfTzBErzbWXRQKeE6x2 RiKLDDMpRb/iGEq9mCVTATQIQbghn0wgK5kVZGFebiq7r0DKmpVW2PohVsV8kuSsxW c6bFaMUU2NaeZhPA/vY0tcmGiGl6EgXBTJW7b8eY= X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (mail.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FcLNp4FlyIWz for ; Thu, 31 Jul 2025 15:46:41 +0200 (CEST) Received: from smtpclient.apple (unknown [194.169.219.181]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.gna.ch (Postfix) with ESMTPSA id 7887D2381821 for ; Thu, 31 Jul 2025 15:46:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1753969601; bh=PsHLx5GXRpdYOfw8C7B2la/HHyqr7RS/XOCUVCfThFc=; h=From:Subject:Date:References:To:In-Reply-To; b=Y0GaAUD4DghyoSC9g1b6cryfjz4sNQtqaD/K+RCJtyYreOAgPM9+TkKOy1tDenQJ4 N2VcEbX2q2ApgpFiRQO3dgdTsWGkRmer9HEksIhoLBm5yDv3i8bB7c3NEW0nLdm63N BnU0jWZYdFVdaWkqSFezKZ+QuY4BroXxDIVAtmws= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body Date: Thu, 31 Jul 2025 15:46:41 +0200 References: <095f25f5-695b-46d4-9f31-5d7e7a04ce05@rwec.co.uk> To: internals@lists.php.net In-Reply-To: Message-ID: <7E01A890-E986-4156-B598-ECD07264C39A@cschneid.com> X-Mailer: Apple Mail (2.3826.700.81) From: cschneid@cschneid.com (Christian Schneider) Am 31.07.2025 um 13:16 schrieb Rowan Tommins [IMSoP] = : > I think an inline syntax like this would be a powerful feature, and a = potential replacement for the @ operator: >=20 > $fh =3D null; > $fh =3D try fopen($filePath, 'w') ignore (FileLockedException); First of all: I'm wary because partial error handling seems dangerous to = mel do I know all possible Exception types and which ones should abort = and which ones should continue? Or will it encourage try ... ignore = (Exception)? I have to admit that I'm also a sceptic of converting every = possible info/warning/error to an Exception but that's a different topic = ;-) If we decide to add something like the above I would very much prefer = the try ... ignore block to be an expression with value null on error, = making the first line obsolete. One could still use $lines =3D try file($filepath) ignore (FileLockedException) ?? = []; if another default value is preferred. Regards, - Chris