Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129352 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 708ED1A00BC for ; Fri, 21 Nov 2025 01:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763690277; bh=Fzi65/PzqeVvcfvhC3tg7Go7NmtDF1P8tS/z0J4WWu4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CgTQy0q3gWTPX2fqDYHDLuApWl9V4GSJySU4VlaJ+jzblSRLrUpihFUaVFGCxprho F9MTTgbLHuB/+PH5J6ubZNwxKikrVLpmvnvpqmc8iQBT79zAocXuOnpPgMwHkFB5UA MyBAUV6TFkH6pxtTHyTzuOOUa4VPrQJKBot2RzrQSdyWwTqamIBg/0S1UJ2BvEQhxO oKmuBlWeYoEg333ZXMpy5UtKzQHVMydWCnRA412Q7IQLeNnlps6IUdHyp4VXitYMP5 ozmDaCV1V6lABKyrMvuktDo0mlHAlfUjFCWLp0hcbo5qAMPYVsqeXpuzLwMWbc8Vbo y92dMFWw7GKtw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 142AA180340 for ; Fri, 21 Nov 2025 01:57:56 +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.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_40, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazolkn19012011.outbound.protection.outlook.com [52.103.32.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 21 Nov 2025 01:57:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KCUG45SA37EowaTjnRl7TzWybu1ec6ZgjBgiWc1PY+IHqNDR/1ZbI1nh22EG5p4jgMXnullbEKUh4u4mScg3dj4YcAeBfnlu7Yjn1HzCZSzI0lLL5JcMpa4gFSvdscQLC25y6kNuayYxInQ9EUE2NTlvBV2L+6yWQEew97bjtqGm6nDJMZ5W72K3pJhhOWcdQKafpPSymoxiX3qhIfVH6uU9MJRWmEXWMy7i3cOyQndDJd/nkpwSLPxwCwZPNS6ou5OfA0aNZkLlpB4cC/FwDE2CcN5wn8KIZ4TZqsKY4eoNKy9gWLQDFXiZ0VyiA7nU3assF3YaUAfGPxD4gI1J2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bCf5H7f7k2yFQC4FNAP7Bhxq0VRpYwWeUB7NSOJ0cbA=; b=y7y77NGV+qlUS+5/9NLVdr4p30g3pNI84zhPuDy9IM1n0BCtoZVO+xXF/tDzDGdxG/elY/YvbvFjGyjbkbudIhMPB+NT73M/c+DQNVqjkArq5ft9BowIv6nj/6YlMTPagP/+stPbS0YRJYs19IYgnF98uKbStUDWZbfDH+ctS+vhsNBZSczMTLO792GxAggtdcxV5v7jrtokR6SQ5iH/tFFn4T0XglOzApp2q/ZukiUEeoTumWvt8IsIAmU82uu5uJnxlEMhqmpCD9O78h148IIJid8o6p189owIbvNJVMabQ73dPID3PnHDjCU0dpGwbsvBqsu+Vxp4CKZU9idWpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bCf5H7f7k2yFQC4FNAP7Bhxq0VRpYwWeUB7NSOJ0cbA=; b=ferKAfp1vzl9EIxesrw68p8yRomL6sr1BEMaYTnfjraPbnLaW+Rl7V0kHhMjI+uySeGtpGMLUPCjqKhs4lvucBB4j91Pa74d/1srpfc3kHbuaRysJHLXTAcOIE0NgyrqNkLgB0wp9fvUW4igENuXZkJKnGTRoKvuMG5tCLRwyZpBcN4t0UiqL7zd6hDsGKHY6U95N+Vm8gg5+OVFDD+McgXLa8BBfT5ag3qVdajcTH86M0xhmwrhYbPNHJezK8aGrFBGyOHabb7Dsj6OLjgqMwXg7mcMaSxlcCeE3JT7/iBMPrJ7hecpFl/SbFJ+zGsUJmIuOFZfXq4qjzu6I5okTw== Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) by GV2P250MB0875.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.10; Fri, 21 Nov 2025 01:57:22 +0000 Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff]) by AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff%3]) with mapi id 15.20.9320.013; Fri, 21 Nov 2025 01:57:22 +0000 Content-Type: multipart/alternative; boundary="------------FWI4PZLxfe0CaosmmXztEnic" Message-ID: Date: Fri, 21 Nov 2025 02:57:21 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Stream Error Handling Improvements To: Jakub Zelenka Cc: PHP internals list References: Content-Language: en-US In-Reply-To: X-ClientProxiedBy: AS4P191CA0017.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::7) To AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) X-Microsoft-Original-Message-ID: <32634b0c-baad-4e16-a699-bf9f4867ed9e@hotmail.com> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8P250MB0170:EE_|GV2P250MB0875:EE_ X-MS-Office365-Filtering-Correlation-Id: 8022cccd-1995-42d3-1e1a-08de28a14f58 X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicCO8OP9JSHQ+xjWRIebUMjRbJUvapYNmxbm5vU2JthxwMN31wF9tNdCQeHgBag4sOqjctcQRg/mZUvr0iW1y/uYxvwff4fq9SXbNC0eiHzHogNAmhL/UXTXiJHiJxzTXwSjPIrIg8V4yJGN4/69dCGvYWOUZTHHVQoaUMgQKZYPVKQB9MXgNyV+JMuF5TPaKUDkO19v8/jPSARYYh2YskzjoGzaDFNdW3AqsocH6oQijayYHVXNBXQhsEQZnpPWVmcXWTGYDqLTO6SnANKDbXWcYqm+plpJbh4+fumlnm/D4UXaV/fSeZpmbotwc1lYvT3m9QMpj7FsS5JoBDMiRXjI6Mvt6c2PRDyCa5hRIzA+MfYAryIuV4F2rHRsmRoXVfV0xsGueAIB2rwFZGXtSaiBin4DJirmUt4+xn4VOf6iitxVaMxVDvAhggjEh4Z/Ao0DJ2kUwbR1Q+7MkWzEiZmuR/Z3DMQYVPnozTR9t4Pn5bLFIqINPR9Qe281m291us+a4RErwkBR5CDFqt+c/Pn6o0qHCtI3CwOEFXgiExGS0Tx22nXnUvYCLtJE5EgvIYuFvwILhs/HcoyuEwU5JvaFCldX9neIaZbliPLJE6pgQcrjnOgPzEbnHPHva2xFxPmbbptoWGRIF3aCFyoBLuMn1tTXgH0f8x6hkF8VswgdijvuSF8e4PMdbLLkz2tOdwt8WWug2zcrNpJJOBKCM04ASh0AxM0G9U9fEniItOzaog== X-Microsoft-Antispam: BCL:0;ARA:14566002|12121999013|23021999003|8060799015|5072599009|19110799012|461199028|15080799012|51005399006|40105399003|3412199025|440099028|26104999006; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WHlIaWk4RzBNejBzaExSVVBWSCtsS2R1MWNaRVlmQmdkYUZhNFE3SzZQSC8r?= =?utf-8?B?V0V1L0RSby84NUhiUTgwbmsrbDhtTkEvelpVc29abkJQUEFTaGFRMXNqRzlH?= =?utf-8?B?R3BOZkF4RVdsQ2VGMUNWd2FXQTJYWlJzVnhyTnluL3NpdDdIZkIzdXV4OFpj?= =?utf-8?B?MWdsbnY4ZFV3dTJWbjJrL3RqYVl6YTdPVmRUYWhSVnRjbmcxS1JTSnp4SHpL?= =?utf-8?B?TDR3RG9PQ1BqL2ZwOGFsbjBMN1RyWm5hTXdyV0NGMGRocVUwYWFmbDM3SExG?= =?utf-8?B?RXhWQS9RaEpyTUlDVFdNWFBQTjdPOXJLclZSYTNOK1J2MEVwdFlVTk1zbWxJ?= =?utf-8?B?S2N2enBnS21wMUR2WXQyUkRQdS9rTmkzU1ByaXBxUjJPakMwNXJjNEVmb3R1?= =?utf-8?B?Yk8ycEJjSlE1dWs0dC9EdHBJNGFDYkViYncrWTU2RUwwcXVHUm8yeDJGajZR?= =?utf-8?B?U0U1REhoT3V5UmJmRUkwd21EeFdWaWh6bXNUbkluakwxNUpiRFNmUUF6aWJv?= =?utf-8?B?T0hsK2VqOURVcEJ1cENDdWUxVHNncTcyeEFtRksrRWkzVTZrVWtVZTRUK1Ry?= =?utf-8?B?QXRLakVqcXljbzNNU2hGVzhqS3oxeHBBcW1vbmdQRGRNOWRJUk5GTDRCZVNC?= =?utf-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ltVEhsQXc3NU5sdjZs?= =?utf-8?B?bEdIcE1EaG9HRytxQzdqdW5EL0o0NlAvVkp5a2ZZRkt0eVlOVCttcWdmNEFk?= =?utf-8?B?Mm5KYm0zVVhaYW9zSnA1TFJGRWNlRmptQU9oUHRpZUZPc3ZyeXlsclU0VUUw?= =?utf-8?Q?vzrvfWDNU2lU0AU+ec=3D?= X-OriginatorOrg: sct-15-20-8534-15-msonline-outlook-5f066.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 8022cccd-1995-42d3-1e1a-08de28a14f58 X-MS-Exchange-CrossTenant-AuthSource: AM8P250MB0170.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2025 01:57:22.2756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2P250MB0875 From: bobwei9@hotmail.com (Bob Weinand) --------------FWI4PZLxfe0CaosmmXztEnic Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hey Jakub, On 20.11.2025 13:03:08, Jakub Zelenka wrote: > > My point here is that $code generally does not get used for our > Exceptions. Whenever we need to attach extra information to an > exception, we do it as extraneous properties. (That's what my > example with ErrorException was about.) > > I.e. ignore the existence of $code (just assign zero). > > And add an extra property for the StreamError enum (which now > needs no backing). > > class StreamException extends Exception { >     public __construct( >         public StreamError $error, >         public string $wrapperName, >         string $message = "", >         public string|null $param = "", >         ?Throwable $previous = null >     ) { >         parent::__construct($message, 0, $previous); >     } > } > > Does this make more sense, described as code? > > > As I see what you mean now. I would prefer to use StreamError name for > the class holding all the details including code, wrapper name, > message and param as proposed by Jordi because this could be also > passed to handler and retrieved from the stored errors. It just seems > not right to use StreamException as a container without being thrown > (is that done anywhere?) so I think separate class for handler and > stored errors (or single last error) seems cleaner. Although > StreamException would be then quite similar. I could pass StreamError > there as a property but then it would duplicate the message so not sure. > > In any case I think it's better to call that enum StreamErrorCode. I > will still find a clean way to map it to the defines > (STREAM_ERROR_CODE_* macros) because that's what I use internally to > set code in the error. So not using int value for the exception code > won't make that much difference from the implementation PoV. I don't mind the name, whether you call it StreamError or StreamErrorCode. Or maybe call the class "StreamFailure" and the enum "StreamError"? Just a suggestion, I don't care too much about the actual names. For the internal implementation, does it actually matter passing around an int value or a char pointer with the name? Which would allow you to directly pass it into the enum lookup. But yup, do whatever fits you best here :-) (Ranty tangent: Umm, what's even the internal proper way to get an enum value? Manual zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name) including zend_update_class_constant()?! We ought to figure a way to create the internal enum case objects at compile time, then we could just reference them directly... Working with enums internally can be annoying and fetching *feels* slow (even if it's just a HashTable lookup).) Bob --------------FWI4PZLxfe0CaosmmXztEnic Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hey Jakub,

On 20.11.2025 13:03:08, Jakub Zelenka wrote:

My point here is that $code generally does not get used for our Exceptions. Whenever we need to attach extra information to an exception, we do it as extraneous properties. (That's what my example with ErrorException was about.)

I.e. ignore the existence of $code (just assign zero).

And add an extra property for the StreamError enum (which now needs no backing).

class StreamException extends Exception {
    public __construct(
        public StreamError $error,
        public string $wrapperName,
        string $message = "",
        public string|null $param = "",
        ?Throwable $previous = null
    ) {
        parent::__construct($message, 0, $previous);
    }
}

Does this make more sense, described as code?


As I see what you mean now. I would prefer to use StreamError name for the class holding all the details including code, wrapper name, message and param as proposed by Jordi because this could be also passed to handler and retrieved from the stored errors. It just seems not right to use StreamException as a container without being thrown (is that done anywhere?) so I think separate class for handler and stored errors (or single last error) seems cleaner. Although StreamException would be then quite similar. I could pass StreamError there as a property but then it would duplicate the message so not sure.

In any case I think it's better to call that enum StreamErrorCode. I will still find a clean way to map it to the defines (STREAM_ERROR_CODE_* macros) because that's what I use internally to set code in the error. So not using int value for the exception code won't make that much difference from the implementation PoV.

I don't mind the name, whether you call it StreamError or StreamErrorCode. Or maybe call the class "StreamFailure" and the enum "StreamError"? Just a suggestion, I don't care too much about the actual names.

For the internal implementation, does it actually matter passing around an int value or a char pointer with the name? Which would allow you to directly pass it into the enum lookup. But yup, do whatever fits you best here :-)

(Ranty tangent: Umm, what's even the internal proper way to get an enum value? Manual zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name) including zend_update_class_constant()?! We ought to figure a way to create the internal enum case objects at compile time, then we could just reference them directly... Working with enums internally can be annoying and fetching *feels* slow (even if it's just a HashTable lookup).)


Bob

--------------FWI4PZLxfe0CaosmmXztEnic--