Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130168 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 8CA701A00BC for ; Wed, 25 Feb 2026 13:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772025475; bh=IZItqJ7yutebhma0tOPIYucEH2NMn4d9dvy4YO+M/jo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XwhK+Q0sAiKSlzi8KScX9m5LDn9PnjSHDvIdlmaH8C8ENdbXyNqMXUoeClzEW7iDo KG6kcSCRNWPE69dU5JbAAQvWnmCBBWMamTwb3xYhsZ3fuq+E21K03rxb+zLhOT12xC 8srrviP4s2we6YarR6g+f/aOw4iInbodf+7CTSQtFh5xkcQU9ChRH6sUh7gIub+C9b rvBWa0xmiqi+W7Kp5s6oivU5JitJUwaAXChAFbMmcTgoaTF1AMXn8XajCQRanp3r9V aNXr9oPUt46Tc6spJlcC958z7YlU+ZT1OUSSCFpUZL+k3sPHfK9nJnq20wDRUevwJv 3e2ihO/hAsAAw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F4B218050F for ; Wed, 25 Feb 2026 13:17:54 +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_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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, 25 Feb 2026 13:17:54 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5a0ff30b240so1060022e87.0 for ; Wed, 25 Feb 2026 05:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772025468; cv=none; d=google.com; s=arc-20240605; b=f0L1R12oyEDAYPTyUiGtSaUyt9UNdub6g+/SOpauRuyIFPtBZbI84ZIY3IQGMs7pm7 wq6PfyBFrVuZd0gUo8egMlAsOG+Hg/rRpd5W6ImNxzukcFR2NlcmirVIIo245BVF2lr6 bDZZdCSfLZIZSZymgP+BBgdXSitpkxg+JawotOGcjLdthVNt6KF59hImucVupPMEmG2c nT6UrFMIHgqHfH4pmvkx1mVFGRLWwZL2Q/u6cVEvwH/HOG0ccNsTenbuGKjhkVu+gWuX heMhB9KgNzdA9+IYYeCkPj5JWmdSGBSmC8ViOWcHkvx4Tyrfqj3eVDKXB9n+zrNcNLyR CI5g== 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=inrbAx6M88PFTGrQxLmsyO07HLKme4ZBT7AaMLERNkg=; fh=gV2bErYqsjkEP1ro2uZgwXmqawsU/Kobl7sdQMrcI34=; b=PnTagPJuO4kdnnugZForETj+nOw+gM1jHZNK7DWkKgCR1m/b9hmdd88mstklQGJi5T lmAvj8dPomvYf7wDIOk5t2NuYxzLQ1IBVkbDNV0scm+eq1rrr75Qkp6tLNcTt3gmfLDF BACq+9A0nlWOGOj+LfgDp5HwMOAtJLbMojW9e3Qv2J0cszSP9XcjsPebLrvo5SkeqThA j0Gh4leIrXIk294snBsxQ9oRJcxKikk/C78utNm+ejfRGZdnT+OtKMvDznbnmLBqYbrV WXPeYUU5fFIbRzx2AzTm0hnFR2FAaPmYM41xkO6owhqoqj4QP9dQf2TwapZ1RfRf7Mug qV9Q==; 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=20230601; t=1772025468; x=1772630268; 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=inrbAx6M88PFTGrQxLmsyO07HLKme4ZBT7AaMLERNkg=; b=BAIMDYcb2IapWPTrcio9tsitlpspBVkVnVM1NrzIS/A1u5ETv++9EWSMCItqi2sedv 1hkoUzwtHSLsPoQMo1awjx8QPiuW6kDFNg2tiW4UE0Le1ViRIMiAQq2NxQFVGjUWW5Np nEFUaqsZ7K1QLikApz1ugovaRAgsACp73e9chLXumtYFCIm6IPZoasnY1+iUyYHHXUKL XZShJqNVSSFPhzSZJhLJ7jLFcLoPhnysIz2tpNgWTLUOJ7ybMbs0eH2B4w6FpHQmS7GJ qktG11c93RCFZioZXZisSMmTk30sCQFD9ris2WOfdQymjOUxmcm6HJiIiSAZ0y8Bn7kX jvfg== X-Gm-Message-State: AOJu0YzuUFUlS5Mg4K5wWhc31j8POLynU65HO3N+anPOZQEsv6Nv0mJu HpqYCSxMYv4xEJgVDZfpTbhJhe3ZAuW58mzJ4tekJ6zLKJTdFveybSkWBNgRYrs4YMZkXFgLAnq Uqsta8qnnSvTjkqfd9z9X1YpW7AVbd9753w== X-Gm-Gg: ATEYQzyQJiDyxGjoyWCZg1fTyn+y5HBOwQnQP8lETH2BUV0XKXGCSfRittRWkkQnq8F XYSykal2CkmbYcVfGAwsuVGlUpRfA6QOLthX9yaqhTE40SvvM/lmg57oTP6Md3rms21nP3OMVAC fbQve2k6fwVP4qbRYWEUUua+8wUWgJyxfL3sXPYzfNBrbcAT9ov2Qizy4pXBKBmc9/S3M5o8FL2 jkpn0DB2Y0x7IthU2JqrD7GLnx5V3K0ZWjuliq0a4nny9CRkzsjDq/BrSfvTGbEDpSGJmC1g656 oJAZtYk= X-Received: by 2002:a05:6512:32c7:b0:59d:f12c:9f1a with SMTP id 2adb3069b0e04-5a0ed99c689mr5332971e87.29.1772025467335; Wed, 25 Feb 2026 05:17:47 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <7ECDE859-153C-4732-A3AB-716540489413@cschneid.com> In-Reply-To: <7ECDE859-153C-4732-A3AB-716540489413@cschneid.com> Date: Wed, 25 Feb 2026 14:17:36 +0100 X-Gm-Features: AaiRm53_ftstevtHjbHaHDP87hsfOJAdhJX74SfRnb3Ow6h9fMJX_r9DTzv3LTU Message-ID: Subject: Re: [PHP-DEV] [RFC] Stream Error Handling Improvements To: Christian Schneider Cc: PHP internals list Content-Type: multipart/alternative; boundary="0000000000008378dd064ba5d4c1" From: bukka@php.net (Jakub Zelenka) --0000000000008378dd064ba5d4c1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Tue, Dec 30, 2025 at 9:24=E2=80=AFAM Christian Schneider wrote: > Am 29.12.2025 um 19:52 schrieb Jakub Zelenka : > > - The storing of errors is done at the end of the operation grouping an= d > contains only the last grouped errors. So the function name was changed t= o > stream_get_last_error(). It returns just a single StreamError which has a > next property pointing to the next error if there is any. > > I assume the chaining was based on Exception chaining but the example cod= e > under > https://wiki.php.net/rfc/stream_errors#error_chaining > looks a bit clunky to me and I was wondering if returning an array of > StreamError would not be more straightforward, i.e. one could then use > foreach, empty(), count(), array_first(), array_last(), array_find() etc. > instead of methods like while, $e->count(), $e->hasCode() which would mak= e > it feel more idiomatic to me. > > I thought about it and I think the exception like chaining makes a bit more sense here. The thing is that in majority cases there will be only one error so it would be most of the time array with just one element which seems a bit wasteful. But if others also feel that array would be better, I wouldn't mind to do follow up RFC as I don't really feel strongly about it. Just let me know during the vote and if there's more people asking for it, I will do a follow up RFC. Alternatively it could just implement iterator or array access, which I was thinking about, but not sure if it's not too messy. Kind regards, Jakub --0000000000008378dd064ba5d4c1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Tue, Dec 30, 2025 at 9:24= =E2=80=AFAM Christian Schneider <cschneid@cschneid.com> wrote:
Am 29.12.2025 um 19:52 schrieb Jakub Zelenka <bukka@php.net>:
> - The storing of errors is done at the end of the operation grouping a= nd contains only the last grouped errors. So the function name was changed = to stream_get_last_error(). It returns just a single StreamError which has = a next property pointing to the next error if there is any.

I assume the chaining was based on Exception chaining but the example code = under
=C2=A0 =C2=A0 =C2=A0 =C2=A0 https://wiki.php.ne= t/rfc/stream_errors#error_chaining
looks a bit clunky to me and I was wondering if returning an array of Strea= mError would not be more straightforward, i.e. one could then use foreach, = empty(), count(), array_first(), array_last(), array_find() etc. instead of= methods like while, $e->count(), $e->hasCode() which would make it f= eel more idiomatic to me.


I thought= about it and I think the exception like chaining makes a bit more sense he= re. The thing is that in majority cases there will be only one error so it = would be most of the time array with just one element which seems a bit was= teful. But if others also feel that array would be better, I wouldn't m= ind to do follow up RFC as I don't really feel strongly about it. Just = let me know during the vote and if there's more people asking for it, I= will do a follow up RFC. Alternatively it could just implement iterator or= array access, which I was thinking about, but not sure if it's not too= messy.

Kind regards,

Jak= ub
--0000000000008378dd064ba5d4c1--