Re: RFC [Discussion]: Improve unserialize() error handling

From: Date: Wed, 21 Sep 2022 16:10:36 +0000
Subject: Re: RFC [Discussion]: Improve unserialize() error handling
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-118683@lists.php.net to get a copy of this message
Hi On 9/20/22 21:24, Tim Düsterhus wrote:
My understanding is that this attempts to gracefully handle broken cache entries and force a rebuild if the payload is invalid. This will fail if the serialized payload contains a malformed DateTimeImmutable, because DateTimeImmutable will throw an Error, instead of Exception: https://3v4l.org/eB5ZE. The 'catch' should likely be adjusted to catch '\Throwable'.
To add onto this: "An Error could be thrown" might also happen with a PHP 8.2 readonly class that later removes a property. As the property no longer exists on the class it will be considered a dynamic property which is disallowed on readonly classes, thus throwing an 'Error', not 'Exception' during unserialization: https://3v4l.org/Xsmfu Best regards Tim Düsterhus

« previous php.internals (#118683) next »