Skip to content

Commit

Permalink
[user-entity] [site-entity] [plugin-plan-entity] Fix PHP 8.2 deprecat…
Browse files Browse the repository at this point in the history
…ion 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
  • Loading branch information
DanieleAlessandra authored Dec 3, 2024
1 parent cb66b97 commit a1f7948
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
1 change: 0 additions & 1 deletion includes/entities/class-fs-plugin-plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/**
* Class FS_Plugin_Plan
*
* @property FS_Pricing[] $pricing
*/
class FS_Plugin_Plan extends FS_Entity {

Expand Down
8 changes: 4 additions & 4 deletions includes/entities/class-fs-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
exit;
}

/**
* @property int $blog_id
*/
#[AllowDynamicProperties]
class FS_Site extends FS_Scope_Entity {
/**
* @var number
*/
public $site_id;
/**
* @var int
*/
public $blog_id;
/**
* @var number
*/
Expand Down
13 changes: 13 additions & 0 deletions includes/entities/class-fs-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ function __construct( $user = false ) {
parent::__construct( $user );
}

/**
* This method removes the deprecated 'is_beta' property from the serialized data.
* Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
*
* @return void
*/
function __wakeup() {
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 );
}
}

function get_name() {
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
}
Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.10.0.1';
$this_sdk_version = '2.10.0.2';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down

0 comments on commit a1f7948

Please sign in to comment.