Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129820 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 14D4A1A00BC for ; Wed, 21 Jan 2026 19:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769022101; bh=AM2FQhEg7mETyWlxHEN2BJ1UvvDV/PaEdiwN85SyNs8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=PVPrzGvpQ1thek4h2/r0/6oViAUlKqPWD/xRWEJxb+ldAMbH2ae9BFZrR9euw7VVF VXoihLn9AAVACK6sC+kv2HgSTpavVB15yuhFHWBbd0JY16VBTjD9U1M/NG8FP7nBKc 9r3HwFDz1KPfALwl5Cvq2cNc77l4ZewbdV1fjVz9AiGq0oQ6wGoertsv53F/e6Ezle lBFAuE/QyRWOE3LKQVA6lFXZbs7cGndg4xBOFY11zIAPeT9eoakV4H9hvKIvcZG4xk 8rM8//H0+trbby4GB6yR8Zb1kn0f/eJrPMPEYxKFVU66+oUjNIyO3gXUItLCUyAkBp WqDaVmaeeLdnw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B5D4A18004E for ; Wed, 21 Jan 2026 19:01:37 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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:01:27 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-4359a316d89so130242f8f.0 for ; Wed, 21 Jan 2026 11:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769022081; x=1769626881; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b2/WZ6vB8qXag4wWNAr7FGNwOmt60l6jRCSMEH7sd/4=; b=Kt6YIvgNIglCydyi1iStky4OFf2r3q7lBEsHSYzWD/ZbVtPsamH+tpbp7Uv12iHp/a IZWNeshdj25TvCXkxid3qWahUTFvBu5iHQPMcFLhcAmd9v6pIf3ehaEdl5BmEBrCCatk hNHcPrhor256F7BSe8LBiPjqKB6SM5qqgpW3EgxYyio2VJyTbduLA5OzHrXSyZirhFEk Cr7sxooAjW5DGucHLOuA7VReynmrKLC4XVobVh8mPzcgAioddlgegyORtEkfA0Ie9Jgb 11IlfItFdCrMfEus/pChMDYzkSgO4hWCtNqzKK/md0+uEsxr9wO6JDtqsHsdvaEoO5Xm VoLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769022081; x=1769626881; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=b2/WZ6vB8qXag4wWNAr7FGNwOmt60l6jRCSMEH7sd/4=; b=FxcZ677OsxLVAvjEAaudwzRlOXTOwcjLAd1s8p1htxIZ0+oAGXZQJEDJHYqw5iNnOT nqf25OQzEr6njaPnFG4j3YnkSbEFVfSFCkyjP/qYo1mQ16+uCwBf2wS2CllQp3qQsO7Z BLGq/9AI2+XZctxTuo/eTVcWetYPkT6Tp5wBm4nksUGTVrWjwsA3PbPkDdvvlC0iUNWB Bm3IxgDMnRNNnlxz+c94jcocEhFaBAklPf+THdMQvcobDo9hsorplc2bgRnWMzJ0PihU q/VblvcvKuOlipJQe2OdkoXc8NIaxDqzZA+zCzDkPvS96XEHAR/Xb7jSZIdDM69U6v/R cFVA== X-Gm-Message-State: AOJu0YzPHvgM2m6xuH+7QMELeVtFMo0RG0aS0T01ONsLm3y/IoOvb4dS PtIGreSvTYSFUH9c641WxOICsiFrWjOXk7OCl/PN/ztssITzSl8stJk5 X-Gm-Gg: AZuq6aJspZL0OvGYKUKY2ePI2jxnOR7IrRj0DFjH6lmJFwD7QHlo3qkYMGMKEP7yq3J wZil6gYPB3uFGJKe7Om+JDMNi1q2CMZuwO83E63HUafBhwPV/OfFq60jfv6ZKskJ55GMZyX5S+h 8ZpGczonkAwFtTSct9XiXpdrK6AABRI1ldXzRuIM6vdW49cxwbUC6013u+xtqDyK2rP21AD3P1W hxeEWBF14jRdGS+vUlwvdRHrH8jBt2TTT8I5UPX309Z6tHNR2EYr0q6Krq3K334kfQA/su3xPZR xgbMUq1KIB7jKBAQL1Tum+J5/bgNo+ysSxJ/7Q5AbcxnslG8WqvrjrD1OKVTp99e7qts6f3t6hV d195XwAFH5ZpEak5boVxGvAhIi3FvHVVlEv2I8CvE0kLPVDxz07OStTt9Cn345DzN6JPn8FGbjF zUv2RIZXxodQnDJVMxYnnRtlEybSandhgCGA== X-Received: by 2002:a05:6000:26ce:b0:432:da3b:5949 with SMTP id ffacd0b85a97d-4358ff2b2cfmr10427340f8f.21.1769022080757; Wed, 21 Jan 2026 11:01:20 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356997ed8bsm39421572f8f.36.2026.01.21.11.01.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2026 11:01:20 -0800 (PST) Content-Type: text/plain; charset=utf-8 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: [PHP-DEV] [RFC] Context Managers In-Reply-To: <905d9879-70ef-4c87-8578-26519c6d4818@app.fastmail.com> Date: Wed, 21 Jan 2026 20:01:09 +0100 Cc: php internals Content-Transfer-Encoding: quoted-printable Message-ID: <17D1E653-A3DC-43FE-B3CF-A40AA31F5467@gmail.com> References: <905d9879-70ef-4c87-8578-26519c6d4818@app.fastmail.com> To: Larry Garfield X-Mailer: Apple Mail (2.3864.300.41.1.7) From: claude.pache@gmail.com (Claude Pache) > 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 from=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 = two.=20 >> C'est la vie. :-) >>=20 >> Naturally, Arnaud and I feel that our approach is the better one. In=20= >> particular, as Arnaud noted in an earlier reply, __destruct() is=20 >> unreliable if timing matters. It also does not allow differentiating=20= >> between a success or failure exit condition, which for many use cases=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 = feedback=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 is = executed inside a `using` block? Is the relevant `exitContext()` handler = invoked, just like for an early `return` or `break`? This is probably self-evident, but it is worth to state it explicitly, = because, for some hysterical reason, relevant `finally` blocks are *not* = executed with `exit`. =E2=80=94Claude