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

WordPress Trac noreply at wordpress.org
Thu Sep 25 13:18:07 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 desrosj):

 My comment on the PR did not make its way over here. So adding it to make
 it easier to follow:

 > This fixes the PHP >= 7.4 instances, but I think there will be problems
 for PHP 7.2 & 7.3 when `__wakeup()` is called. That method will only ever
 pass an empty `array` to `__unserialized()`, but the previous behavior was
 to restore the properties within that method.
 >
 > I have not been able to find a good way to pass the instance through to
 `__unserialize()`. The only way to fix this may be to preserve the
 previous logic within `__wakeup()` in addition to adding it to
 `__unserialize()`. It's a bit of duplication, but it will be removed once
 support for PHP 7.2 & 7.3 is dropped (hopefully in 7.0).

 I submitted a PR to @SergeyBiryukov's that re-adds the previous logic to
 `__wakeup()`. After that, I am seeing issues on any supported version of
 PHP.

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


More information about the wp-trac mailing list