Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129291 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 1DAC71A00BC for ; Wed, 19 Nov 2025 05:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763529270; bh=kvkH0kFXWxc9zA35QwgJW2R/QvLmbuTBFhuyVoE5RnA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=nYM9fvenmKaxY2U3vyA/+rP8nyelNvXTLJI3v0RvjHbR0z2A3SvDGJGff+NX0lFKh q6H37knfy9yRQShy3zqzec4Xh0kcUaL/A/avETxA8fokTYhdP+6+G4gBoa9zCd1Mu7 Q0F8f+i5GV8NQaU4z9mY5FOFazIxIH0ndfIOACQcqdF2fNETLi9AcOOEuRP8je6O0/ ebsuc0LaYXAq8+HLiqf2VQgkIHUm1qrBTAQxUVKXd1Ryhwtxrh2967pG0KksSUyTBp S6/0x/Mf0I9jbjbqGMNc63aEQLK3X7cqtoCbZj+vDmTlD64CFpoU6fQpFsK2QJVSAk jonWeECLtMwXg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A8EE1180040 for ; Wed, 19 Nov 2025 05:14: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=0.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,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-northeuropeazolkn19012045.outbound.protection.outlook.com [52.103.32.45]) (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 ; Wed, 19 Nov 2025 05:14:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NQBDbVmH+wzUQdLoCcjlfOaqJuuPg6M3BZSbVhTmv33zkUMi0K9C0ByPqESMDosnHJmdl6AahMMbHTWuGLWTfsVZfu4YzLxUE2ceZ9AtNxEhW6tvQ6ot3jNHj+XYj4CIav91l50eEaUjPxfeuA52vCV2UWgZTCDIA9qHVFfju9v8UAlwouVOxtSby/ohpMkRkOi2cQ/bfwytzOoMb5H7Qj3RbFDGeJ1E7pj2kUQobx2nrM2O6jnGm8G57E8rL+M69JvXSXyJNtaSJxn5S8ATeHULL3i9cCWY7UtWN/vXyDl/O1NyIGc1FhHZozU8DvIgWR3Qayi6m+OJn9031Wt30A== 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=cO+PORKbB+AelOWgIoRuxM0KPRvq/mrb4qYmmBesorU=; b=q8xqaDbhDYSPCfcqqHiS75Fgi++VJQiiWbIpnIfPwduhHS82yatrxGV2pPXPm51BoJaT7ImD71scnECYfH9NaKTliBSK7kEQH/6/Q7jDxXl4h8fjR7bTCm4m5Tq5ctWQrHeW22vKb42GjE5XK7SWJC+efFsFQFYDz3z6zQrAPxSUmkBUeCBwdxlItajRiiWat8AIMhtfSXrHF7GQgt2Ibf89PD8l0VvWMBnMwgHKoxSE3TX4/21g+b61yB/C2hm0rOLxkxYp0MYXm19wlY4OCYogNmEhCu1tin6tD8Nf8etVxrYCTZIlpnYLXkBid5ceMaqjYTVvU9sE3Ta5fQXU/A== 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=cO+PORKbB+AelOWgIoRuxM0KPRvq/mrb4qYmmBesorU=; b=PrjlXDr6pJm9AJEu7gcPpcT/t0qv7WdrJxnKRZ7uGP5lGaKB5bOdK7PgyUxr9mWPinV0A1ZH76Cvx6wyyRAjsJYZFJV6C321MajtXcydao6DXjemcLXVpF9Ki3X90kd6xkMDFwb1gn3LKoWq5qbWc3H8RtZn+ZJPrWst2jcqnlCjSvxSnm+3tN8opzrFnWp4rONo6P0NVuIfXRQbD7RvtqXgJwZE0vQSr3jsq6L3sHqkGp7nJPgV+tTBjgBLVdVa4h8CdesftOVvFpRr8RHSncRzIUdevPCmWngWDcqvdlwmFYkpWVErSTx3UtgU5Ua+U/X25nAk24nzbGmj1AhE9w== Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) by DU7PPFD5367DB8B.EURP250.PROD.OUTLOOK.COM (2603:10a6:18:3::b63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.10; Wed, 19 Nov 2025 05:14: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; Wed, 19 Nov 2025 05:14:22 +0000 Message-ID: Date: Wed, 19 Nov 2025 06:14:18 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Stream Error Handling Improvements To: Jakub Zelenka , PHP internals list References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BN9PR03CA0343.namprd03.prod.outlook.com (2603:10b6:408:f6::18) To AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) X-Microsoft-Original-Message-ID: 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_|DU7PPFD5367DB8B:EE_ X-MS-Office365-Filtering-Correlation-Id: a165b109-99b2-498f-abcb-08de272a7f90 X-MS-Exchange-SLBlob-MailProps: YfhX3sd/0TWnHr2aTc7oye/bilYJDP7y6Pkr6c0lmQZEiboxDpYWrU/NhOoJwLAzMPwmwtHOEtIRd9RJClWZZSQiqT//oIY/fdV79BWzkJrCIAFf0xvQBpTLqE7l2valjVqD8DnJIhcxMQrj+zw+TvidsdnzYBjYqO4RQdfv9EgDiD+7eXQlrceK/dIaN+DH+2G87CcHSf9vRtnmCvvQnS5m67P8GPt0F/IY6zjb0hz8tuLU1X9qXjdYw4XRawhF79zh2YeEAmfeVavqaMK33r9q0bQJ3ufgt4R7vqIyyDhDBxgepkdf/VASFj7QoWYnd3/MsB8X3O9K5BSCm7FGRwCK8fk71TGRHie95VXDPKTlFfhD08X4LOrgTlswNKcga3Y676fE3/O+Vp7OO2mhNWMFjOnvyP6iZRCca+f/PWBBWW1sgu53RPnBHotHCFoAwAOHbdgRxgltPXe1vDf9jidvk+Bo3EGlnyPHHtofL7wyz2jcNEMuPjgeIcrWmCi8hOK9ULrOfj8exTVx3ZDzOXWiBLK3JmMW1c6SEZHBLzfGzskPgLtn4qGwlEipBkbWtGE13I8/Q031O5P9xjmkFtjByVR7oWqpAUSlaslNirhGYX8sIgNAE2K8DN4gcranMHjmiWzGHkVt9tI2WQz03t0fyJphCrcJbd/IlTVcfbW+swzrLJfnoQe6EJW4/3d8Mq6i0Sx0ghR2LcUGX89ciUZRqUNXkGrruSjOWMDJIW8KydbEz99XC2nF9a0G06+FpBunz5B5KXTUn7NOGMFZVMexP8Fj3PFAQ82Nls+4SX4= X-Microsoft-Antispam: BCL:0;ARA:14566002|461199028|6090799003|12121999013|19110799012|15080799012|23021999003|8060799015|41001999006|51005399006|5072599009|440099028|26104999006|3412199025|4302099013|40105399003|10035399007|1602099012; X-Microsoft-Antispam-Message-Info: =?utf-8?B?cHFUcE5kUmYxTzhydWg3djJiMmthVUdIZ0UzclpxbXUvTlgvdHlQeC9lUkN1?= =?utf-8?B?dEp5SEJ4aEpRbjg2WVhqQ05tVGprZHNRUmdnb2JaNDUvWC8yZDRSQ0FNK0Fr?= =?utf-8?B?eWhjemxobXNNTnlFdnFlK2JnOGhlSTVpSXR5MzdNQ3pIWFJoRk5FcUxGL21l?= =?utf-8?B?RUlsaCt2ZGtOc2pHVFpWRS9ZSkM0aWhkTVN2czlxT3dRZWpEQmI1TmIrNDE3?= =?utf-8?B?TDhLT1gzaThYdmY0WmpRSW1vZjlZOVdwL2RHOTRhUW5Wam9qdGR6ellZdExu?= =?utf-8?B?ZEorUDFkZ29jSUNKV3NXZ28rQnRpWnI0aFl0VGNjOTdQL2Z5ckNTaGZzSmNB?= =?utf-8?B?YjhaQmUvQ2s3RGdFTi9oeGpScXk5U01YbFh5VTMrUU1jNi8vK3NoNUgwcGRD?= =?utf-8?B?eDVPSWxYVytWNUlZWGtXR2dNbCthdE5zT25tM2VVajJwTE5IVm1TbXMzSjlB?= =?utf-8?B?M0Y4KzJ6cmtZUGt3R0YweTdpUytVRk5YNk81YWN4eE81TzJjb3Qyd1pYRE4x?= =?utf-8?B?N0xGY3pKajZTQnBwRDBXRk0rdHljUmZ2d2JvdnIwbi9vb1BxU0NveGxUL3Yz?= =?utf-8?B?TlpNS21ZS0lQcEtyOW5ZR24waEVEWmt1RGd3N1dZ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dNT3py?= =?utf-8?B?NG5uR3prVEJzYTlyaDBhc0swMGVxd1A3ZzdXQzczSHdTdDBaOXpSK09VZUZZ?= =?utf-8?B?Q2dEVUFuOHBDeC8veThnQ1lQR1FDZUFydGpmQ0MvRyt6aW1BRjhybTZBSjYy?= =?utf-8?B?M21DLzFsZHBTK0Y4ellXd2ZaaS9pUjVwQkRTNTZkN0xYVWxQQU96WXpTVnJJ?= =?utf-8?B?VTJNTW45K0NJR3lEN2M3N1dJU056OXFTYzNnZVh0Z0ljWVNVMjZxOFJjT2hZ?= =?utf-8?B?Nk1TNzlVT3lZV0dhdjFtZWNJL1B4NmhGYjNscXpLVS9OTGJtaHJJaUQ3bHdp?= =?utf-8?B?cnhSYlNhaXI0NHV1QWJRU1RNa3lucHBGMUdMd3FrTllnQXFZSUhad3gvN200?= =?utf-8?B?NlhtaktxT0l3anFQZXdOMU0xck9FTlpRdWt2b2E3YWpGOU5GSWhweTVROWtS?= =?utf-8?Q?Lj7+igOGA34Y9cahg8=3D?= X-OriginatorOrg: sct-15-20-8534-15-msonline-outlook-5f066.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: a165b109-99b2-498f-abcb-08de272a7f90 X-MS-Exchange-CrossTenant-AuthSource: AM8P250MB0170.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2025 05:14:22.1093 (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: DU7PPFD5367DB8B From: bobwei9@hotmail.com (Bob Weinand) Hey Jakub, On 18.11.2025 19:38:37, Jakub Zelenka wrote: > Hello, > > I would like to introduce a new stream error handling RFC that is part > of my stream evolution work (PHP Foundation project funded by > Sovereign Tech Fund) : > > https://wiki.php.net/rfc/stream_errors > > Kind regards, > > Jakub I super appreciate that you've tackled this. This has been a big wart in PHP's stream handling for a long time. I have a couple questions: Why have you chosen a big list of constants rather than enums? I think we should push for enums where applicable, meaning enum StreamErrorMode, enum StreamErrorStore, enum StreamError. You define what a terminal error is, but does it correlate to specific error codes? Like, is a given error code always terminal or not terminal? Or can some error codes sometimes be terminal or not terminal depending on context? I've tried to look at the code, but I don't quite understand it, e.g. php_plain_files_rename: When chown or chmod fail, the error is terminal. When the copying fails (did you forget to adapt php_copy_file_ctx?), that's non-terminal, though. Reading through the code, I have the feeling that operations which do not call out to other operations, which can error, are terminal. And all others are non-terminal. E.g. failing to open a file is terminal. That the copying where the file opening is part of, failed, is non-terminal. And then *additionally* some operations, which don't prevent success are also marked non-terminal - squeezing it into the boolean for the purpose of not erroring. Which makes some sense to me, but the description in the RFC is really confusing here. And the meanings are muddied. Thus, if I understand that correctly, there should be an unique mapping from error code to terminal. If we were to go with enums, we could make it trivially a property of the individual enum values instead. Should StreamException be attached the non-terminal errors which are caused by the terminal errors? I.e. StreamException clearly is STREAM_ERROR_CODE_PERMISSION_DENIED for example, but it happens during a copy, so, should the information that a STREAM_ERROR_CODE_COPY_FAILED was caused by that, also be present on the StreamException? Are stream errors which happen as part of a fully wrapped functionality marked as wrapper error as well? Like if the server sent an invalid TLS response to a file_get_contents("https://...") operation, making the whole operation fail? You obviously don't have access to the intermediary internal stream resource there, where the stream error is attached. Is this what the logged errors section is about? Is that section talking about "php_stream_display_wrapper_errors", which can concat some errors? I see that this logic is mostly retained. Do I understand the implementation correctly, that user error handlers can be called multiple times for a same operation? E.g. when copying a file, you'll get first a PERMISSION_DENIED then a COPY_FAILED? Should these not be somehow merged? Especially with global user_error handlers, these cannot be aware of the fact that the permission denied is part of anything else - at least not until possibly a second user_error invocation happens. Also, is the internal resource used for e.g. file_get_contents() leaked into user error handlers? I'm not sure whether that's desirable. If that's intended, that's fine too, I think. Further suggestion on stream_get_errors() - why not return a proper object instead of a loosely typed array? Proper typing, and creation is actually faster. Also "docref" is so... antiquated? maybe just "function" and have it contain the function name of the current operation. Does stream_get_errors() ever reset? Looking at the code it doesn't seem so. It will just forever grow. E.g. fwrite() will report an error every single time when the buffer is full and a write is attempted. If errors aren't freed, that's just a memory leak (as long as the socket lives). This is a serious flaw. Lastly, stream_get_errors() is overkill in a lot of cases (especially when using fread()/fwrite() on simple sockets). I just care about the last error code (there's just going to be one anyway). I'd love having a stream_get_last_error() returning just the code. Overall, I like the direction of the RFC, but I'd like to see improved handling for "terminal error inside non-terminal operation having its own error" in particular. Enums are rather a suggestion, not a requirement, but they would be in my opinion very fitting here. Thanks, Bob