You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught Exception: Serialization of 'SerializableDomDocument' is not allowed in script.php:20
Stack trace:
#0 script.php(20): serialize(Object(SerializableDomDocument))
#1 {main}
thrown in script.php on line 20
It appears to be sort of an expected behavior of PHP 8.1 due to ca94d55, but I would still expect:
the change to be marked as a breaking one in the PHP 8.1 release notes;
serialization to be allowed if the descendant class explicitly states it is serializable by providing __serialize() / __unserialize() or __sleep() / __wakeup() method pairs.
PHP Version
8.1.0 - 8.1.9
Operating System
No response
Reacted by Ilya Yarkavets, Marcin Oleszkiewicz, Fabrizio Saponaro, Gabriel Felipe Soares, Vitalii Shtykhno, Kiryl Poyu, Héctor Arroyo, Jérôme Bogaerts, Yaraslau Kavaliou and Jim Chang
Oh, it likely has been overlooked that this might break code if the class is subclassed. I agree that we need to document this change (some other classes/extensions may have the same issue), and that we should look into supporting (un)serialization for respective subclasses.
Activity
cmb69 commentedon Jul 13, 2022
Oh, it likely has been overlooked that this might break code if the class is subclassed. I agree that we need to document this change (some other classes/extensions may have the same issue), and that we should look into supporting (un)serialization for respective subclasses.
Introduce a way to (de)serialize subclasses of un(de)serializable cla…
Add a regression test for phpGH-8996
Fix phpGH-8996: DOMNode serialization on PHP ^8.1
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'
[phpstorm-stubs] Update DOM stubs for serialization
Fix phpGH-8996: DOMNode serialization on PHP ^8.1