Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129821 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 254951A00BC for ; Wed, 21 Jan 2026 19:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769022428; bh=7A6pxoxb58j2jPeL9j8P0NHe5qBV6ExRhsEIAGQLv7s=; h=Date:From:To:In-Reply-To:References:Subject:From; b=YAOw31fx4wPmncu3N4NSyyzaXwro1BjR9gWyL+HxGkGvDeTy3d6RJr7QqzDgKrn8u YcGZkuxcfEvdC2hhscNJ+lRBpsaNiNL6OqY/tawZZGt3/xOx3p5qGQRV1oMgeEh/gA WkLxBACHksewEDc21zfWWiv3UYOMCR/QklO/XHq/5DLEK1rBDhPuKA4inIk7kwq/d5 ZZtnRvdkxAPha4p49ghMTJIkyP1Cbve5kBjntriUJJPQO6D841c8s8hVCnaPbvxrfl BtKtvmDaKTuzJ/H+8eyhZ7M0mXi4AXTlJAH98z4rGCHe+4uqbAHQZH33Fh6nOIwhFp d3Kqdcla6tSFw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CC7FA180068 for ; Wed, 21 Jan 2026 19:07:07 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (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 ; Wed, 21 Jan 2026 19:07:07 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 4AB55EC007B for ; Wed, 21 Jan 2026 14:07:02 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Wed, 21 Jan 2026 14:07:02 -0500 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=fm2; t=1769022422; x=1769108822; bh=aqiDpzCmmTLjoIphXa7cB xZDLu749zsnCVcrF2CP5vI=; b=ontBhvs6sr1/dnRJe3cxu4HnhxWlyyrLayTxx 3SapzNEPzTHwqpYhkETs5RQU5BekcIDLvYp6aEr9DQZp1aGfUZ/4eTFLq6OhCM7S uRgOwq/xi5XSZTjaodZ7xmco8Ya560rbbXkwMqqjFHIdu0rci8G7RNcsi1OnCCku OCtp6jg98hEmBxrWbprAgCyXnQ2pHeFGu5qnbODTlsz68jr7BQ1o6w1nTjhHHrVo MOerIns46ZdB8DwBr0ofJfjWsShS4dN4YTUwAMpyTLafjXB8M3XltGuSuKbniA1N DCrkrTkN+W+OUtvGIIIJRDR2r19Et1539B6Nrs4jp2+JeX68g== 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=fm2; t=1769022422; x=1769108822; bh=a qiDpzCmmTLjoIphXa7cBxZDLu749zsnCVcrF2CP5vI=; b=s4dyknE6LmIi8NhEB 7pbjY5qTpe8a3aNhIjJqX1nZNqRY7Ooks6/ZdOaFUqsgYpFLGSDvjbHhyen19s7q NmTQonqBa5HXXL1XMTSFgZ4LuqBO51W3eLE18zAm6RO/q5ozpO7H0fkP2N4fLffQ UeebNEiDeuauoRkGXqcJQBHW24QY9ot1CgTLHz27ElTog3eDGwmcX/2s0xB086k2 ZqVoh2JafsX1EkvZIzhjwePxiov1CHPwqN8EdNfUTincoMKF6IVqlYaB55GFEA+w XEiVFBZdIiXgJE5tDUY3stBAPlexs3b4SepHTSdobvfH2nzcA1psTgg8IltsFsfX vNKXQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeegtdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1585C700065; Wed, 21 Jan 2026 14:07:02 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Atmh9k-BTBuN Date: Wed, 21 Jan 2026 13:06:41 -0600 To: "php internals" Message-ID: In-Reply-To: <17D1E653-A3DC-43FE-B3CF-A40AA31F5467@gmail.com> References: <905d9879-70ef-4c87-8578-26519c6d4818@app.fastmail.com> <17D1E653-A3DC-43FE-B3CF-A40AA31F5467@gmail.com> Subject: Re: [PHP-DEV] [RFC] Context Managers Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jan 21, 2026, at 1:01 PM, Claude Pache wrote: >> Le 13 janv. 2026 =C3=A0 23:19, Larry Garfield a =C3=A9crit : >>=20 >> On Tue, Nov 4, 2025, at 2:13 PM, Larry Garfield wrote: >>> Arnaud and I would like to present another RFC for consideration:=20 >>> Context Managers. >>>=20 >>> https://wiki.php.net/rfc/context-managers >>>=20 >>> You'll probably note that is very similar to the recent proposal fro= m=20 >>> Tim and Seifeddine. Both proposals grew out of casual discussion=20 >>> several months ago; I don't believe either team was aware that the=20 >>> other was also actively working on such a proposal, so we now have t= wo.=20 >>> C'est la vie. :-) >>>=20 >>> Naturally, Arnaud and I feel that our approach is the better one. I= n=20 >>> particular, as Arnaud noted in an earlier reply, __destruct() is=20 >>> unreliable if timing matters. It also does not allow differentiatin= g=20 >>> between a success or failure exit condition, which for many use case= s=20 >>> is absolutely mandatory (as shown in the examples in the context=20 >>> manager RFC). >>>=20 >>> The Context Manager proposal is a near direct port of Python's=20 >>> approach, which is generally very well thought-out. However, there = are=20 >>> a few open questions as listed in the RFC that we are seeking feedba= ck=20 >>> on. >>>=20 >>> Discuss. :-) >>=20 >> Hi folks. The holidays are over, so we're back on Context Managers. >>=20 >> [...] >>=20 >>=20 >> --Larry Garfield > > > Hi, > > Just a small question. What happens when an `exit`/`die` instruction i= s=20 > executed inside a `using` block? Is the relevant `exitContext()`=20 > handler invoked, just like for an early `return` or `break`? > > This is probably self-evident, but it is worth to state it explicitly,=20 > because, for some hysterical reason, relevant `finally` blocks are=20 > *not* executed with `exit`. > > > =E2=80=94Claude At runtime, it's "just" a finally block, so it would behave the same. W= hich I agree is absurd, but this is PHP after all... --Larry Garfield