Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129444 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 A15831A00BC for ; Mon, 24 Nov 2025 22:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764024540; bh=D7Uey/aYIG4nGo3FvTnvDJ+9bjBNNOtlsHakx8Uz6VY=; h=Date:Subject:To:References:From:In-Reply-To:From; b=Gue98sxWLzGJ8zb3ZDpZLbd6OkAbeg5zWkSXBYFS8lkAH6ExKkNHJzo4h9NBSWpat kH/NR6URD4g9trGCxRkDsxqmTH70NXVVAHotWzyvQb+9H0A5pfSBkOdAQtwJBfc3+q QClfkl+qzyEjbDmm9Y5djIF0EkN4VCUcm0Jf7eDTeYDumSBQLZ+5HZfSYF1gUIoBSB Mh/olGKoKiTXiDwkRgziP73et9Y5ETwECuVqy4SOcWLihd4uRRq8mZ3uRdxUdNwmcz 252zojZIdYRWXWYu3nhH3vKpCyJXhQKE8fIvrpXzSIbiXty5yaqijkKccYqS+XdIUS /5v3xyHZ3Nmdw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 53B5E18003E for ; Mon, 24 Nov 2025 22:48:59 +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=-1.4 required=5.0 tests=BAYES_05,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-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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, 24 Nov 2025 22:48:58 +0000 (UTC) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 7B9141400078 for ; Mon, 24 Nov 2025 17:48:53 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 24 Nov 2025 17:48:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=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=fm3; t=1764024533; x=1764110933; bh=u1yxd2xOlw 7PiUrU/M3TrrqOw816UbbIcK010lf5wWw=; b=Ceq+3YcmtKd62FaVGKiuJ9BVeO 7pJJsjG6E6RDv9IcVHtFLxN8k2NU7GipVmNlgD91l/g9P6H+Z0BHIAzxR4zZiFO/ +0cUGC/Ir+VDiSjqWZ652NKdZgZTfl/MAG1eC8JoCbzv+NppPNaEMaU4kdem/Cvs 66+tynWG3MAWZzXlS/S34XXHqjOlVxbOEbTqh+xqIiyh+p97A/nnPsO9jHcGmIXB xoU8qgQjzqBCE5QpE+Bx3D493rhiWCxuT6B0+fke3aVkIu/53XfLueR/xo8OWSkn tRNMQ12aUMUeDKLBNK+oRrPQuUzj2GWOl+kHml3rEuc1itlUdmm2OU0VZ1Tw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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= 1764024533; x=1764110933; bh=u1yxd2xOlw7PiUrU/M3TrrqOw816UbbIcK0 10lf5wWw=; b=iK4MiNXy9krlwqYbQuPUdTHYBV7Gt5ZCni3XwQe89towaDx+0vz 3tvGx+cI9F62nqYG14uAj/fADIz6cyt5UmVfczusvcDFV0LvLMVisQjzgGdQxLRT QswqH2yMtcLk31lo9LS84PQ1FBiUxZrnnxCqyr2W1VjEn9voe2H9pLbIzQdUkM9s ltrhfYCyobfcvOBrjws5KiWSqvf5f7oWLtfT3W7zxtt2mCD9tyHEvj08phgI/58f DKzHLHno4p6w8Ss4YhyW5ACqlZ7d+cljtqx3L5llOJqKe3vasM4ZwIhm8R/z7IgK IdPFuVO++Di6j5ym/Cq+4dAWpRO71cVeuCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfeelkeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtreertd dvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehi mhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepfeekje ejteehtdduveelveejudevheffgeevleejfeekkedvheekueeigeefteejnecuffhomhgr ihhnpehphhhpqdhfihhgrdhorhhgpdhprggtkhgrghhishhtrdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphes rhifvggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 24 Nov 2025 17:48:52 -0500 (EST) Content-Type: multipart/alternative; boundary="------------IOoQc0izP4iteTdLAYC0MRSz" Message-ID: <19693420-c091-49b7-b557-e09717239d9b@rwec.co.uk> Date: Mon, 24 Nov 2025 22:48:51 +0000 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 To: internals@lists.php.net References: <92865666.4510.1763818506332@email.ionos.de> <329450798.8037.1763822426377@email.ionos.de> <9287c46c-bc63-4dd0-9792-0f9421959589@rwec.co.uk> <65869feb-d518-4de3-8c10-115e3ba7dce7@rwec.co.uk> <55149f3e-7ec7-4479-bd6d-2e7fe1b8edef@rwec.co.uk> Content-Language: en-GB In-Reply-To: From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") This is a multi-part message in MIME format. --------------IOoQc0izP4iteTdLAYC0MRSz Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 24/11/2025 16:57, Edmond Dantes wrote: >> An error will occur for whom? SDK Susie when unit testing her library? > If SDK Susie used a new coroutine in which she calls the > `LoggerInterface::flush()` method, then with some probability the user > may notice that log entries are sometimes duplicated because the > `LoggerInterface::logs` property is not being cleared. > You could say that SDK Susie is responsible for this, because she ran > code that was never intended to be executed in a concurrent > environment. Just to be clear, LoggerInterface is not an imaginary example, it's right here: https://www.php-fig.org/psr/psr-3/#3-psrlogloggerinterface Packagist lists 9539 packages which depend on it, and has logged more than 1 billion installs: https://packagist.org/packages/psr/log It is an absolute certainty that a PHP library will want to both use async I/O and accept a LoggerInterface as a dependency. >> If it is an error for SDK Susie, what is her solution to allow users to pass in a logger to her library? > To avoid the error, SDK Susie must be sure that the > **LoggerInterface** implementation supports concurrent execution. Susie doesn't know anything about the implementation, other than what is defined in the interface. That is literally the purpose of accepting an interface. So it sounds like her only safe option is to restrict her usage of async coroutines to small self-contained pieces of code, and only use injected dependencies and callbacks in the "main" coroutine where they were passed in. Regards, -- Rowan Tommins [IMSoP] --------------IOoQc0izP4iteTdLAYC0MRSz Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 24/11/2025 16:57, Edmond Dantes wrote:
An error will occur for whom? SDK Susie when unit testing her library?
If SDK Susie used a new coroutine in which she calls the
`LoggerInterface::flush()` method, then with some probability the user
may notice that log entries are sometimes duplicated because the
`LoggerInterface::logs` property is not being cleared.
You could say that SDK Susie is responsible for this, because she ran
code that was never intended to be executed in a concurrent
environment.


Just to be clear, LoggerInterface is not an imaginary example, it's right here: https://www.php-fig.org/psr/psr-3/#3-psrlogloggerinterface

Packagist lists 9539 packages which depend on it, and has logged more than 1 billion installs: https://packagist.org/packages/psr/log

It is an absolute certainty that a PHP library will want to both use async I/O and accept a LoggerInterface as a dependency.


If it is an error for SDK Susie, what is her solution to allow users to pass in a logger to her library?
To avoid the error, SDK Susie must be sure that the
**LoggerInterface** implementation supports concurrent execution.


Susie doesn't know anything about the implementation, other than what is defined in the interface. That is literally the purpose of accepting an interface.

So it sounds like her only safe option is to restrict her usage of async coroutines to small self-contained pieces of code, and only use injected dependencies and callbacks in the "main" coroutine where they were passed in.


Regards,

-- 
Rowan Tommins
[IMSoP]
--------------IOoQc0izP4iteTdLAYC0MRSz--