Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118573 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21989 invoked from network); 7 Sep 2022 15:35:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Sep 2022 15:35:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7B1371804AA for ; Wed, 7 Sep 2022 08:35:16 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 7 Sep 2022 08:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1662564913; bh=tlUzdLlaB0FrWYn+jtPnxMhk6LaNQav6iZmA5CwzDK4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=kMOtr4wIwYiH4d9sr0/M7r0lTl+/ENGIIs5SAFH+wUggMmTz5JPQAyfDKaTMTvdrz P1itK9MTqSy7yFV9l5a8cyjkwSS8qwoo+nEoLbB5/X1Ynt4Vws/9/jlpMfnh0pQ4h3 nZlNu1kBihUwMe6FFGDNWI+QVX9DhVzzDnTDzSETcF4kRu93By4S2+vF597IokGltw KmVa41d3FcGIR4Cv0L49/4yMygR9qidq4IMrtnqz05frsFXDTz82bY9txFZqWEpjyB CTYBe5LH5mSoWPa/zk6CHkpASHuuPFXs1SfzHlvBozvtEvvgOae5eAtUfcEnlS5IVF jb4NKEcq/rOEA== Message-ID: <51f97d1a-7fb0-a97c-daa2-71e82d603f0c@bastelstu.be> Date: Wed, 7 Sep 2022 17:35:13 +0200 MIME-Version: 1.0 Content-Language: en-US To: internals@lists.php.net References: <530b3a9d-0ee4-6061-8c69-df672d238032@bastelstu.be> <2252734.ElGaqSPkdT@come-prox15amd> In-Reply-To: <2252734.ElGaqSPkdT@come-prox15amd> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC [Discussion]: Improve unserialize() error handling From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 9/7/22 14:41, Côme Chilliet wrote: > Le lundi 5 septembre 2022, 19:20:00 CEST Tim Düsterhus a écrit : >> RFC: Improve unserialize() error handling >> https://wiki.php.net/rfc/improve_unserialize_error_handling > > Is the new UnserializationFailedException class extending any other Exception > class ? This is not explained in the RFC. Yes, it necessarily extends another exception class, because \Throwable may only be implemented by \Exception and \Error. \UnserializationFailedException is a direct child of \Exception: 1. Making it part of the \Error hierarchy was argued against in this comment: https://github.com/php/php-src/pull/9185#issuecomment-1199580418 2. Using a different parent class does not bring any benefit, because the intended use is to specifically catch(\UnserializationFailedException) and not to catch it together with unrelated stuff. I've also added a code block to the RFC that shows the full (and trivial) implementation of the \UnserializationFailedException. Best regards Tim Düsterhus