Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128325 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 D6B801A00BC for ; Thu, 31 Jul 2025 06:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753943666; bh=0e3mmXpoWp0h8McEQAmmHIocWwdvJer9FaMFQtNifCs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BkvA46WsVKhu2FJhpLa/FM2FPOdKStrRso2k68a3vT8csE7e610p4lxJIF9WhvrtL PGJsPmSTEL2Mjyz5dalQKEhrhhyXNzhSwEe+tzbonWnQYzQA0PuzxwtgOtvMp1pbWB VM8rpVrUNke799ghzuKqTcV93N8soVD3JcZB1Yec/U8yG2k1TzPmAshZX2iHR958YA YP2V4VpVkveqcMPzsVNbalmYalJdpQzNRbslVlkc7Nka5VQP5NDnOLw5Ln+07gAOf4 nDac0dmzQTF9RysAcaCTEB/ByLfmvh3xoig7mMQQH1hKdbxwPQjALTc3iDLNQxyqE0 M0HLiFDc9s8EA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D1492180079 for ; Thu, 31 Jul 2025 06:34:24 +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.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_MSPIKE_H2,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: <91liahim@gmail.com> Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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 06:34:22 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e8e22a585bdso43364276.0 for ; Wed, 30 Jul 2025 23:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753943764; x=1754548564; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0e3mmXpoWp0h8McEQAmmHIocWwdvJer9FaMFQtNifCs=; b=hF7Irl07yHP6k/qfAoTIq8QSOcexnL3th25JJhMJFGnH6UTCA6czysMdO7FCm+8zSM N/lj9l4I4SR8FDEu4dM/DjZxhtyvULL7VY27PrRWD0Go0B+8WuDZdGuX0nldihlQEAPP nt3X/tGr+iKmZ9Mkq24V94Hl2n5VyzqTe3jtHNR4caPuxRcexPr6QvmR7FXsG5dJV95f HoI8aV40M/g8L9MDz2vpb/B2FGoOeu0mqK8HAyo7RvpfpW7nOZT8DQhiZa6LXs5xNofM +D0fFNuI++/eSodQhjKitVgj2TwOEmfttAP5vGagqOkukZU8w9+IZ8puuKz8WwkuBqTA bu8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753943764; x=1754548564; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0e3mmXpoWp0h8McEQAmmHIocWwdvJer9FaMFQtNifCs=; b=ofFlX15HnhX/NWgNrSIcM8ZwwScAV6HB9fCjof1rgwtqmRYhayM4VZhENBHBJOWW7V NUBo5v7kjEvFbfBT22NJ0GazyXA5NPuxVBGjPGgh59WZhK2NtAkW+BFRwRMqF5BXedfv 5lgpewlkxFpz2gDETJiH3pFyGgXf8IvGNb39TM783rWRPMUGACVr5vGA3Db4LxlVDSNZ 9cbWGGeHYydtHZCn+tKYIc/yOYIOf5GT+800obzEW2X1Ggd8z7Wcd9NWJIpQ/IQb15M3 Ip3jlH6M05pr6Djb6NLfJjBg14XbJpW9diQ3tN8owx3d1FDEnYiEN1pvEWNhf1F6Ijcl bdtg== X-Gm-Message-State: AOJu0YwwtfD02/jenOT9TTuRxSRwKpC+WXgUhMszMpzhn74YQM2HZO3z Yhkhd9zdQ573hryfgQwpC1n1tKvDQheBwogoq4QjsuiFEPqKCVbNWyIAyZCQUkusxRu8WVRjAmU 9kKn4QBMv5TT2oLx6OK09NGzKT1tBSUU= X-Gm-Gg: ASbGncsoJ6o2L5nfcVd4vRUC1+DBBXxBdOE5iu+VZe1vUKMQNyO9/VTo7iPbNLzikvH gAiP2O39WtW58DwghVexqC/ZOhzjHyUdMoNSpAnDhEcIqzKFLBVtmOArEDT+VSjBjNrkXCcxBNB gXCYmUl/+XNx7zpYbECe5lPrpK2XbM/cF4xziOHHfjt5eW5QsCZDHzWXHES28jWbhR+t86KhApd hQLipc= X-Google-Smtp-Source: AGHT+IHjZiEqeY3As1GoVff5Z0sMVn0Ct06cJjU37j2bxdp+GHUsFF2pVG05JPsrJkVHl6WTJNvg0GrvmpTwvJ9qB50= X-Received: by 2002:a05:6902:12c3:b0:e8e:26bb:2452 with SMTP id 3f1490d57ef6-e8e314d86e6mr7401875276.8.1753943764325; Wed, 30 Jul 2025 23:36:04 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 31 Jul 2025 11:35:53 +0500 X-Gm-Features: Ac12FXywwSMq5ess3_z4-9DMpE9KGeLvAhsJZ-4UvWlAJw8LA59vA0xz7dLxcbM Message-ID: Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body To: Ayesh Karunaratne Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000075af0063b33dbb6" From: 91liahim@gmail.com (Mihail Liahimov) --000000000000075af0063b33dbb6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey, Ayesh! Thank you for noticing an important point. Of course, empty catch blocks are bad practice in most cases. But this particular proposal is not intended to encourage these bad practices. I'm just suggesting that you don't have to write an extra boiler plate at the syntax level in situations where it's necessary. =D1=87=D1=82, 31 =D0=B8=D1=8E=D0=BB. 2025=E2=80=AF=D0=B3. =D0=B2 11:21, Aye= sh Karunaratne : > > Motivation > > > > Reduced Boilerplate: Eliminates unnecessary empty blocks when exception= s > only need to be caught and ignored. > > Improved Readability: Makes the code more concise and focuses on the > important parts. > > > > Empty `catch` blocks are a code-smell. If the `try` block is not ready > to handle the exception, it should let the exception bubble up; not > silence it. I think we should not encourage this further. > --000000000000075af0063b33dbb6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey, Ayesh!=C2=A0Thank you for noticing an important point= .

Of course, empty catch blocks are bad practice in most cases. But = this particular proposal is not intended to encourage these bad practices. = I'm just suggesting that you don't have to write an extra boiler pl= ate at the syntax level in situations where it's necessary.
=D1=87=D1=82, 31 =D0=B8=D1=8E=D0=BB. 2025=E2=80=AF=D0=B3. = =D0=B2 11:21, Ayesh Karunaratne <ayesh@php.watch>:
> Motivation
>
> Reduced Boilerplate: Eliminates unnecessary empty blocks when exceptio= ns only need to be caught and ignored.
> Improved Readability: Makes the code more concise and focuses on the i= mportant parts.
>

Empty `catch` blocks are a code-smell. If the `try` block is not ready
to handle the exception, it should let the exception bubble up; not
silence it. I think we should not encourage this further.
--000000000000075af0063b33dbb6--