Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128985 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 3CCB11A00BC for ; Mon, 27 Oct 2025 18:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761588728; bh=AlPXZ8S9kI8uTXNACVHxk4DuS7/lW6WDquv9KkycqFM=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=jkvwhnKoSd4cRN93wtmF2mcFmFiT3bxlj21Phlel8hDbIWOHS/tqcqBCu2o+d1LyF ZzCEg4wsJ4d3sNwj8I7ACXpHKD3fuT7yedw+ALx7necsFeAZ6/acvgWcJ8dOKCBO1h vmMbGu1lPqUhKgwChVw598b59PgGYDV6w4AS+nL6bFqjLyyfo59zcCdw14LnwHh+mG kRDdjX/0HS4J8gyyKZjzSOYinwmhrIsxsfqohIkGa86KL508y5fs3vv2P24sw5H4Kw nJA+qMy829//MIqOsugojxOOLKvhfQFpxmLkggrYWh+wwmIM98rpTdTD1pNAYEnZdB m5++ce0nYYXTw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 87C0D180087 for ; Mon, 27 Oct 2025 18:12: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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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 ; Mon, 27 Oct 2025 18:12:07 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 8EBE014003A2; Mon, 27 Oct 2025 14:12:01 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-04.internal (MEProxy); Mon, 27 Oct 2025 14:12:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc: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=fm1; t=1761588721; x= 1761675121; bh=AlPXZ8S9kI8uTXNACVHxk4DuS7/lW6WDquv9KkycqFM=; b=U DWNK/IW3aV5a2XK16KtRVUFb/kyM9ktqMy4TVEQ5jBZxuCekNJAYpJxnIdEWXK25 VU0S0dqxrwZZzR4h8pBU4po7lMjRBlfsZZoMIAf6LY6yBREnNfj753QSMTEHGVrE n7ywm30JBIMlCn2lX/7cNeRuZ4/SeALwjD3fs7WNrAWPFLGMHHB7eWtrPYYXM/gu 84fEuMyUQVYWUcPSraQpid2cJvEa42NTl+PcTkfrmC5FtoKwISMsfp2zJUSUzaAS UWHZYMfMfMbXaJCibyaLQnGIOfeGkM6L8P53hV1CwFKEc1/u0oo1+ri15pmlehn8 RNyyiY6RySZlw4ZPpjb0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1761588721; x=1761675121; bh=AlPXZ8S9kI8uTXNACVHxk4DuS7/lW6WDquv 9KkycqFM=; b=kjW46ALua1bIf9BTfGZY0pS457PChwmg/KNQsbQ+Ri2rsYIf6AT kNtBm2C5DA+oE+SYKGlMmYfQei/b6Rcx0NTDzc0Lwpoqt+BO/MGoS2embEq0Zylr rN+6DBh3szjeMk5wNO/+/oTS7c6uFb1VCjuz+H3JTb/3tZ5Gfs/NGJH8wgTh3hyB Keq+iwKUo8n9pwbV6LdI+AMWqNhzGTQvLl1OZEDNtw+9Tt9bBWcH5oaCEUen9wSH 1L1J1dV2zcOUcOrJqL0IMwnxWLAKcpFFnizKo/8d7ILMx8YLx+fS9oVZhirhZYQ5 8LxPrYBpqeBdKsRJjbNSsMs5rnNEWHJJsbQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduheekieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfn rghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtth gvrhhnpeeiueethedvvdefjefhgfeiheelheehtdfhfeekjefflefgvedvkeduteejjedt tdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehroh gssegsohhtthhlvggurdgtohguvghspdhnsggprhgtphhtthhopeefpdhmohguvgepshhm thhpohhuthdprhgtphhtthhopehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh dprhgtphhtthhopegvughmohhnugdrhhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohep ihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DE6381820054; Mon, 27 Oct 2025 14:12:00 -0400 (EDT) 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: AQpA1KTaY2GJ Date: Mon, 27 Oct 2025 19:11:22 +0100 To: "Edmond Dantes" , "Larry Garfield" Cc: "php internals" Message-ID: In-Reply-To: References: <889d3042-7b3e-4152-bd8c-09bbcc967309@app.fastmail.com> Subject: Re: [PHP-DEV] Re: PHP True Async RFC Stage 4 Content-Type: multipart/alternative; boundary=29d419df8e1e41f48428f3e769f23568 From: rob@bottled.codes ("Rob Landers") --29d419df8e1e41f48428f3e769f23568 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Oct 27, 2025, at 18:53, Edmond Dantes wrote: > > I am not sure how feasible this is, but would there be a way to spli= t the "async toggle" of IO operations off to its own PR/RFC? > > To me, that is by far the most important part of this RFC as that's = the biggest blocker for wider async adoption, > > but I'm not sure how many layers are needed above it to make it poss= ible to toggle in a safe fashion. >=20 > Ah, I think I understand what you mean. > Yes, from an implementation standpoint, non-blocking behavior is > provided by the Scheduler API and Reactor API. These two APIs are > always available anywhere =E2=80=94 in the core, extensions, and so on. >=20 > However, this isn=E2=80=99t part of the RFC itself, as it belongs to > implementation details. Moreover, do you remember the first version of > the RFC? It had a function that explicitly started the Scheduler. So > indeed, in that first version PHP could be in two states: synchronous > and asynchronous. >=20 > What=E2=80=99s the difference in this RFC? > PHP is **always** in an asynchronous state. Even when executing > index.php, you can think of it as running inside a coroutine. There=E2= =80=99s > just a single coroutine, so no switching occurs (although an extension > could, for example, create another coroutine =E2=80=94 which is perfec= tly > valid). >=20 > You keep writing your code exactly as before. You don=E2=80=99t need t= o think > about PHP being =E2=80=9Casynchronous=E2=80=9D now. As long as you=E2=80= =99re writing code > inside a single coroutine, you=E2=80=99re still writing synchronous co= de. >=20 > -- Ed As far as I understand, the only thing missing from php-src that would a= llow everything to be async is a Fiber scheduler. We already have tons o= f Fiber libraries out there ... but just no unified scheduler. If we had= one of those, then making Fiber-aware i/o functions is "trivial" compar= ed to implementing this async RFC. If we=E2=80=99re going to merge just = a scheduler/reactor, it might make more sense to implement a Fiber sched= uler than a completely new way of doing async. =E2=80=94 Rob --29d419df8e1e41f48428f3e769f23568 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Mon, Oct 27, 2025, at 18:53, Edmond Dantes wrote:
> I am not su= re how feasible this is, but would there be a way to split the "async to= ggle" of IO operations off to its own PR/RFC?
> To me, that= is by far the most important part of this RFC as that's the biggest blo= cker for wider async adoption,
> but I'm not sure how many = layers are needed above it to make it possible to toggle in a safe fashi= on.

Ah, I think I understand what you mean.
Yes, from an implementation standpoint, non-blocking behavior is<= /div>
provided by the Scheduler API and Reactor API. These two APIs = are
always available anywhere =E2=80=94 in the core, extension= s, and so on.

However, this isn=E2=80=99t part = of the RFC itself, as it belongs to
implementation details. Mo= reover, do you remember the first version of
the RFC? It had a= function that explicitly started the Scheduler. So
indeed, in= that first version PHP could be in two states: synchronous
an= d asynchronous.

What=E2=80=99s the difference i= n this RFC?
PHP is **always** in an asynchronous state. Even w= hen executing
index.php, you = can think of it as running inside a coroutine. There=E2=80=99s
just a single coroutine, so no switching occurs (although an extension<= /div>
could, for example, create another coroutine =E2=80=94 which i= s perfectly
valid).

You keep writing = your code exactly as before. You don=E2=80=99t need to think
a= bout PHP being =E2=80=9Casynchronous=E2=80=9D now. As long as you=E2=80=99= re writing code
inside a single coroutine, you=E2=80=99re stil= l writing synchronous code.

-- Ed

As far as I understand, the only thing missing = from php-src that would allow everything to be async is a Fiber schedule= r. We already have tons of Fiber libraries out there ... but just no uni= fied scheduler. If we had one of those, then making Fiber-aware i/o func= tions is "trivial" compared to implementing this async RFC. If we=E2=80=99= re going to merge just a scheduler/reactor, it might make more sense to = implement a Fiber scheduler than a completely new way of doing async.

=E2=80=94 Rob
--29d419df8e1e41f48428f3e769f23568--