[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 20:14:15 UTC 2025


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

Comment (by TobiasBg):

 Indeed, looks like actually setting the object properties has to be done
 ourselves with `__unserialize`.

 See e.g.
 [https://www.php.net/manual/en/language.oop5.magic.php#object.unserialize
 this PHP docs example] for `__unserialize`, where properties and DP
 connection are restored.
 Contrary,
 [https://www.php.net/manual/en/language.oop5.magic.php#object.wakeup the
 example] for `__wakeup` doesn't restore the properties but only the DB
 connection.

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


More information about the wp-trac mailing list