[wp-trac] [WordPress Trac] #63962: PHP 8.5: Fix deprecation notices for __sleep and __wakeup magic methods

WordPress Trac noreply at wordpress.org
Wed Sep 24 06:55:35 UTC 2025


#63962: PHP 8.5: Fix deprecation notices for __sleep and __wakeup magic methods
-----------------------------+--------------------------------
 Reporter:  TobiasBg         |       Owner:  SergeyBiryukov
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  6.9
Component:  General          |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:  php85 has-patch  |     Focuses:  php-compatibility
-----------------------------+--------------------------------

Comment (by TobiasBg):

 Switching from `phpcs:ignore` comments to a config file should be possible
 as in [60795].
 I assume that @SergeyBiryukov chose that config over comments there as
 `sodium_compat` is an external library.

 I believe that the idea of this phpcs sniff is not to reject using
 `__serialize()`/`__unserialize()` per se, but
 [https://github.com/PHPCompatibility/PHPCompatibility/blob/9.3.5/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php#L17
 to check if they are used] in code running with PHP < 7.4, where these did
 not yet exist (but `__sleep()` and `__wakeup() need to be used).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63962#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list