Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130534 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 9BA901A00BC for ; Thu, 2 Apr 2026 17:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1775150739; bh=D5sFw4lYD2Fc1HzFq9NC8AeqledoV0VmAiNT6f0YhN8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SiSQiw7lz9nYnmqhIvL3lGABykjovW+gTP3OR5SHwscW+SvxxksRdMROsfsGWrOcH Jzp+vBuO39OGs5WRQUejRe8GUhJ1eAN5uV+kkRjXblmweNI0yTkUi4R9gbTG/iI8Cl R+NwVs/JDgYoOpi5AUdMlLsJS5/iJCfc/BZZfmslktZgpECB4bIiU9yzI9WxjCp4b6 TLJA5jVIH4PjYoGh0+powcPBVL+yD8emCbIYP5uAFEBCDfVix6aWy+Z0kPjq9hfkdi XdJPRYcCRDvye1uU9NVXxbJMcsJyScQZFibs3R0C8kO3pdmp+bHboFT8DnU99Ec0y7 c+fDMSzCUAEYw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6F56718007D for ; Thu, 2 Apr 2026 17:25:29 +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.7 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DMARC_NONE,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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, 2 Apr 2026 17:25:29 +0000 (UTC) Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-7d7653db148so702924a34.2 for ; Thu, 02 Apr 2026 10:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775150724; cv=none; d=google.com; s=arc-20240605; b=JCr/vmhcg8NpJ9sJVm9spf4NGNIfpNX13ZSj+QJUOAnm6PMwEoPnziqmP5eTba840b 68KX2jM4m8pfRfJQJBrzTaTolJeaFMTfGcxKhRpJMYVHt75ZIuG1fvvsGR4I8EqOtmo/ Kb0VZni/YA8yl8UvAgCv1MmjOFf5N5oPUJhO7ya3ues0Pd7VtQ6pikW2pN8CsXIthcuT 1fis17wV4FnAPJT9w/EyelSiiHkaTY8R7RS6dRwzXHxAGZUmuGqlWBc4lvqfqVoVnMQn mYZYJFHgr5LbnykoVUVMJfCBcEHxjHJIBAe8Qo/P8QQBLdOJb5FH1YTDwZDP9btjAJ1Z u6SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version; bh=D5sFw4lYD2Fc1HzFq9NC8AeqledoV0VmAiNT6f0YhN8=; fh=xhV8QIzz3jPVx84+pzBszRi22uxtxShEKJvpqwKcSws=; b=Vmgp4ZzKK7+YXWG++Qy5XzBNmV5eKcD2xCjyhg+EsdTJVqLDFvVVBDnASGgj+4qA/s oP/guXSp+lSBMuIP9F6nUYBakIChviRC+mW786FTBcJWsW+AFCki2x+VGoGleflXrKC+ 0RG2fRKb4PNsF2iNhGIl5J1wQckgQtKnyMISCy6xFkqARUF6MWEInDy1mWS6iX2eyFeP w3OwMQNByd8c9nBDYrC5QysxCnK+Fzn09KHxzXOKNKXj8GSwV5QXAQuIzGILv8jywmL5 DXvpuJ8AxUPUsJpMnNagp8KjUEStdpPshv6mJWxWiU/fABEHkO++lpWN04+3xfZEI3Y6 pJ0A==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775150724; x=1775755524; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=D5sFw4lYD2Fc1HzFq9NC8AeqledoV0VmAiNT6f0YhN8=; b=k/RgeAOP2QxrjokbCwxjA+UTQT3/0KBu3hdRH+aISBYZ1BLFs2GNcqjGYsqnS98su+ 8nLcaP0drK0aipHmc1ZY87XH2D7VgW/kwg6vFHd43oNPQK7wgp4Wv+9JPZvEVHVXH6VL eBlQWFWnzvGDcYkfyTudgaEM0CePEb5/HXhRdDAWkQyvnLnERM4wNTvkjxgzizrcKMKs BRB232Ba+l7f4KAWCC1vFYso0X2woUjF+H8Me3ScGKIpG8WzbhqUZisI6NjdiToBJnng FgNnJ02VXpo+8FHUK5kLjWctOwS4PEDqTL8MCqsE9Heg/N2a1ippHp5WDL2GMQDMwZX4 m1hQ== X-Forwarded-Encrypted: i=1; AJvYcCXBKg9a4lXa5OIiHmXegpioWW/nf0uRTMQX7Bz7eoaYDn2uHIxCqLxTAy73RDhRPLpPJyapVkQgW+Q=@lists.php.net X-Gm-Message-State: AOJu0Yzqqsjiov/8RCwl9kHt2Roqgcbm2hgciBBbQ/7zWo0emimjzTTL 731gOExr6CzyfQs9/o/ghy3clSDVse5bcQQV4CG5Fe5H8UpRNJGoK7vJ5JA98e3HkPPih0DRhAp dM3ZADjXPAp1nlRwnX8tP5yb7KWQnt+0= X-Gm-Gg: ATEYQzzTrSrK+XRpEPLNVZP1THNisFdaVmL2JxGXjDWzYbj8QcANxLdjWl0u/15Gu4M CWR9MYyP+Ix0a9Tamyi0J1qbojd/MjlDEQsHB+nPOi2qeHIRW3Rlxtrkq9xWiJn8tBc+LYxcvlq 7V5SqwlDQEkLnERXKukWqrf0mtGJv6dIz5EiiVyHCSWwngJTC9Uc/7SKsB7h4Mf/szare1/99+L O4TJ5eAgK+FaVuaPKSuKYkRxK5LDIAgvsWBWFb7Azr6NEFJ8mxP3LPul5b9KjEmYj1rWlFU0fQm v8fwWKU= X-Received: by 2002:a05:6830:440b:b0:7c7:6bb4:1197 with SMTP id 46e09a7af769-7dbb7579a57mr85517a34.24.1775150723588; Thu, 02 Apr 2026 10:25:23 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <1597c99a0ad7dc1e55a40f952d7536c5@bastelstu.be> In-Reply-To: <1597c99a0ad7dc1e55a40f952d7536c5@bastelstu.be> Date: Thu, 2 Apr 2026 19:25:11 +0200 X-Gm-Features: AQROBzAsCFCsRqCDJgY1PF7v22Hp7yC1QJBkpD4wHBxHq5n9Zn2XUHJMpAFQ2CA Message-ID: Subject: Re: [PHP-DEV] Re: [RFC] Stream Error Handling Improvements To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Nicolas Grekas , PHP internals list Content-Type: multipart/alternative; boundary="0000000000004d65ca064e7d7c1d" From: bukka@php.net (Jakub Zelenka) --0000000000004d65ca064e7d7c1d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Tue, Mar 31, 2026 at 11:59=E2=80=AFAM Tim D=C3=BCsterhus wrote: > > 1. "// Search for specific codes using array_any (PHP 8.5+)" > > array_any is already available in PHP 8.4. The same is true for > "array_find (PHP 8.5+)" in the same example. But given it's an RFC for > PHP 8.6 anyways, we already know that these functions exist, so the hint > could just be removed entirely. > > Fixed > 2. In the example example "$primary =3D $errors[0] ?? null;" > > This can just be `$primary =3D array_first($errors);` (PHP 8.5+). Same fo= r > the other examples. The examples should ideally show the cleanest > possible code :-) > > Fixed > 3. For "StreamErrorCode::is*()" > > Can error codes fall into multiple categories or is it always a single > one? If it's guaranteed to be a single category, then perhaps a > `->getErrorCategory()` method returning a StreamErrorCodeCategory enum > makes more sense and allow for simpler / more efficient code when folks > are interested in checking for multiple different categories. Instead of > `$code->isNetworkError() || $code->isFileSystemError()` they can do > `\in_array($code->getErrorCategory(), > [StreamErrorCodeCategory::NetworkError, > StreamErrorCodeCategory::FileSystemError], true)` or use a `match()` > expression instead. > > After doing a review of the categories, I decided to drop all the helpers and not expose categories in any way. More on the reasoning in my other replay to Pierre. Kind regards, Jakub --0000000000004d65ca064e7d7c1d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Tue, Mar 31, 2026 at 11:59= =E2=80=AFAM Tim D=C3=BCsterhus <tim@= bastelstu.be> wrote:

1. "// Search for specific codes using array_any (PHP 8.5+)"

array_any is already available in PHP 8.4. The same is true for
"array_find (PHP 8.5+)" in the same example. But given it's a= n RFC for
PHP 8.6 anyways, we already know that these functions exist, so the hint could just be removed entirely.


Fixed
=C2=A0
2. In the example example "$primary =3D $errors[0] ?? null;"

This can just be `$primary =3D array_first($errors);` (PHP 8.5+). Same for =
the other examples. The examples should ideally show the cleanest
possible code :-)


Fixed
=C2=A0
3. For "StreamErrorCode::is*()"

Can error codes fall into multiple categories or is it always a single
one? If it's guaranteed to be a single category, then perhaps a
`->getErrorCategory()` method returning a StreamErrorCodeCategory enum <= br> makes more sense and allow for simpler / more efficient code when folks are interested in checking for multiple different categories. Instead of `$code->isNetworkError() || $code->isFileSystemError()` they can do <= br> `\in_array($code->getErrorCategory(),
[StreamErrorCodeCategory::NetworkError,
StreamErrorCodeCategory::FileSystemError], true)` or use a `match()`
expression instead.


After doing a review of the categories= , I decided to drop all the helpers and not expose categories in any way. M= ore on the reasoning in my other replay to Pierre.

Kind regards,

Jakub
--0000000000004d65ca064e7d7c1d--