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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php