Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128354 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 94FC41A00BC for ; Thu, 31 Jul 2025 18:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753985710; bh=2+wcv0v7B6Q6W0OzUh7RV+lcKKrCwabNnA/8KU3l/98=; h=Date:Subject:To:References:From:In-Reply-To:From; b=jQDkC6UY7KC3kh4Hct/cLERjXz6veW+92FGaiHKlgnpSo95Fu+UB+LiqnGQTAZICm dp4m1n59sHqkDoAd9NNPdeGOiuvKXwr9M0oCEukna4Ucb7tcaVXXuf6LO1O9XLBqoV 7GXZIRTdXZ0X/m8DHGE23lg5aSe2qSxuoxz9NGoeDcZZ7fLZhSfKcJCFWPGTZC42si yP2NRY6QV6HZQkQzpcVaqMreBS9Sn4zkHgeskfHNt7peXX4cmtJi8+HKmY/3XIDqGd h956DqmJy2xWQ7ddbDHV6fOxYHjlUf+OGi/+6y7mNYIP9wSgWMcCGvNXK4QwGoLpIz 4/AKv61efuzMQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9CB9418006A for ; Thu, 31 Jul 2025 18:15:09 +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=-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_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 fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 ; Thu, 31 Jul 2025 18:15:09 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id CB5DE1D02356 for ; Thu, 31 Jul 2025 14:16:50 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 31 Jul 2025 14:16:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1753985810; x=1754072210; bh=ztan0ycAw5MUOixFXjGOlDePa066skGAXYPziiayXE0=; b= Td9JkqibfOWN9xeOKDZMNzfdcvyDlPIczSFUH/YlmrGfpyXP5yaPwvAeLv5GP3WT 9Owp3Ur99ZyIeUKvnBgzxD50um6VWPHaLpE9C9d/BFX0nBSiPiifXJCfdvvc6I/C Jjec/6WNq2ufzGZsGmbXFSPZgMLHHMseWADaGFGE2F/F7/25c5VjeyMN/uDfS7hw 878UAzcVjS4fx1TBMPQe7dN2aizqn3Wfs4JrzJ5RKTnSXDkKI2mbzUX6W5UhUu1u IYdpPiM/8EcQTSkBkeQTdamVkKp4btJzUorWwc9XxbQqPFdcs2x3d22v3A9KWUq2 3cnK4h5uiOiwYxrFW2q/NQ== 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=1753985810; x=1754072210; bh=z tan0ycAw5MUOixFXjGOlDePa066skGAXYPziiayXE0=; b=I57QW2ASPosvB927J O5SJMlKvkwivZvWhbKuQgDwUrN83dZPibgnR3mTWUr6eywuZztOp33ZSdS++MStT C2wNAITPUfqizYBF2FMgjqeubnU7gMGoB8REvEFz2sGEOZ9AGaq25qhxFXaspcyD UphJwFOYuALnTnewE5LTQD6RB3I0BhdNIsmjmlNYCecaG4M7qT2L86rsscKxQ4LJ MLBooYFpNqNwG1GANLvAzAFB4ukznbj+JDFnaOWWnJfIIi8fRqtggnAKPp4Vv+Fj Fpmawyh8MPuCA+4aruIIM0ykkoB5tZsWXnesTcbfCODvmypsSFr/Wz7dZtbtxt91 WOv2g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddutdduheduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertd dtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceo ihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeejke fghfeugffgtdeuheeggfdugefhudekjefhteegieejleehveelhfefvdfhudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphh hpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 31 Jul 2025 14:16:50 -0400 (EDT) Message-ID: Date: Thu, 31 Jul 2025 19:16:48 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body Content-Language: en-GB To: internals@lists.php.net References: <095f25f5-695b-46d4-9f31-5d7e7a04ce05@rwec.co.uk> <7E01A890-E986-4156-B598-ECD07264C39A@cschneid.com> <33e35f41-8d8d-4413-a36c-4cba4aa413a9@rwec.co.uk> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 31/07/2025 17:24, Christian Schneider wrote: > If you have to handle null afterwards (e.g. avoiding writing to invalid $fh) then the "ignore" version does not really help much IMHO In a simple case, yes, but you don't necessarily want the check directly under the fopen. Maybe you want to try opening multiple files, and succeed if at least one is unlocked; or try in a loop; or try in the constructor of an object, and handle it being null in a later method. It's still mostly syntax sugar (and maybe a hint to the compiler to optimise), but it's saving more than the original proposal, even skipping newlines: $fh=null; try { $fh = fopen($filePath, 'w'); } catch (FileLockedException) {} $fh = try fopen($filePath, 'w') ignore (FileLockedException); But, I'm not volunteering to write a formal proposal, let alone an implementation; I'm just exploring what kinds of short-hand might be useful. -- Rowan Tommins [IMSoP]