Skip to content

Commit a1f7948

Browse files
[user-entity] [site-entity] [plugin-plan-entity] Fix PHP 8.2 deprecation warning adding missing property to FS_Site class and using magic functions in FS_User class. FS_Plugin_Plan has been fixed in June. (#763)
[User Entity] Removed magic method __unserialize for backward compatibility with PHP 7.3 and older Removing FS_User::$is_beta dynamic created property with obsolete data from database
1 parent cb66b97 commit a1f7948

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

includes/entities/class-fs-plugin-plan.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/**
1414
* Class FS_Plugin_Plan
1515
*
16-
* @property FS_Pricing[] $pricing
1716
*/
1817
class FS_Plugin_Plan extends FS_Entity {
1918

includes/entities/class-fs-site.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
exit;
1111
}
1212

13-
/**
14-
* @property int $blog_id
15-
*/
16-
#[AllowDynamicProperties]
1713
class FS_Site extends FS_Scope_Entity {
1814
/**
1915
* @var number
2016
*/
2117
public $site_id;
18+
/**
19+
* @var int
20+
*/
21+
public $blog_id;
2222
/**
2323
* @var number
2424
*/

includes/entities/class-fs-user.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ function __construct( $user = false ) {
4848
parent::__construct( $user );
4949
}
5050

51+
/**
52+
* This method removes the deprecated 'is_beta' property from the serialized data.
53+
* Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
54+
*
55+
* @return void
56+
*/
57+
function __wakeup() {
58+
if ( property_exists( $this, 'is_beta' ) ) {
59+
// If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution.
60+
unset( $this->is_beta );
61+
}
62+
}
63+
5164
function get_name() {
5265
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
5366
}

start.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @var string
1717
*/
18-
$this_sdk_version = '2.10.0.1';
18+
$this_sdk_version = '2.10.0.2';
1919

2020
#region SDK Selection Logic --------------------------------------------------------------------
2121

0 commit comments

Comments
 (0)