-
Bug
-
Resolution: Done
-
Minor
-
4.1.1, 4.2
-
None
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MOODLE_401_STABLE, MOODLE_402_STABLE
This was detected as part of MDL-73587 (PHPCompatibility complete run against codebase).
There are a bunch of classes in codebase implementing the Serializable interface and don't implement the __serialize() and __unserialize() methods that were introduced in PHP 7.4 (as fix for __sleep() and __wakeup() and/or the Serializable interface itself.
The complete message is:
"Only Serializable" classes are deprecated since PHP 8.1. The magic __serialize() and __unserialize() methods need to be implemented for cross-version compatibility. Missing implementation of: __serialize() and __unserialize()
See:
- PHP 7.4. New methods: https://wiki.php.net/rfc/custom_object_serialization
- PHP 8.1. Deprecation if missing the methods: https://wiki.php.net/rfc/phase_out_serializable
And we have a good number of classes that, apparently, are implementing that Serializable interface and missing the new methods.
Note this doesn't cause malfunction for now, only in PHP 9 that interface will stop working, but we should try to look for cases, report/upgrade them if they are 3rd part libs and fix any case found in our own codebase.
In the next comment to the issue, I'll report all the cases found by PHPCompatibility.
- Discovered while testing
-
MDL-73587 Perform a complete PHPCompatibility 8.1 execution against codebase
- Closed