From c69951e33b79d81427c098adfce076c286944e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=A4thge?= Date: Tue, 23 Sep 2025 21:39:49 +0200 Subject: [PATCH] Code Modernization: Address __wakeup() deprecation in PHP 8.5. PHP 8.5 deprecates the `__sleep()` and `__wakeup()` magic methods in favor of `__serialize()` and `__unserialize()`. See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods For PHP < 7.4 compatibility, `__sleep()` and `__wakeup()` need to be kept for the time being. This commit moves the logic of the `__wakeup()` method to `__unserialize()`, and turns the former into a wrapper. The SDK does not use `__sleep()` methods, so this is the only change required. --- includes/entities/class-fs-user.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/entities/class-fs-user.php b/includes/entities/class-fs-user.php index 3aed0982..1da3aa59 100755 --- a/includes/entities/class-fs-user.php +++ b/includes/entities/class-fs-user.php @@ -54,13 +54,20 @@ function __construct( $user = false ) { * * @return void */ - function __wakeup() { + function __unserialize( $data ) { if ( property_exists( $this, 'is_beta' ) ) { // If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution. unset( $this->is_beta ); } } + /** + * Compatibility wrapper of `__unserialize` for PHP < 7.4. + */ + function __wakeup() { + $this->__unserialize( array() ); + } + function get_name() { return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) ); } @@ -83,4 +90,4 @@ function is_beta() { static function get_type() { return 'user'; } - } \ No newline at end of file + }