Le 10/06/2026 à 19:02, Nicolas Grekas a écrit :
Hi,

I'd like to open the discussion on a new RFC:
https://wiki.php.net/rfc/serializable_closures

PHP 8.5 allowed closures in attribute arguments and parameter defaults. These closures are static and capture nothing, yet they cannot be serialized, which silently breaks every serialize()-based metadata cache that meets them.

Would this mean that if you serialize such object (in some cache for example) then change the object default value in code in between, deploy your new code version then load the outdated cache, your object would behave inconsistently, because the default value has been changed, but the loaded object would not honor the new default behavior ?

For caches it's not that much a problem because you mostly clear caches when you deploy, but considering, let's say for example, Symfony messenger messages, which are basically serialize()'d per default, it becomes a major problem.

--

Pierre

Reply via email to