Re: RFC [Discussion]: Improve unserialize() error handling
| From: | Tim Düsterhus | Date: | Wed, 07 Sep 2022 15:35:13 +0000 |
| Subject: | Re: RFC [Discussion]: Improve unserialize() error handling | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118573@lists.php.net to get a copy of this message | ||
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 :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üsterhusRFC: Improve unserialize() error handling https://wiki.php.net/rfc/improve_unserialize_error_handlingIs the new UnserializationFailedException class extending any other Exception class ? This is not explained in the RFC.