-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PHP 8.2 deprecation warning #759
base: master
Are you sure you want to change the base?
Fix PHP 8.2 deprecation warning #759
Conversation
2724729
to
452e982
Compare
includes/entities/class-fs-user.php
Outdated
* Should clean up the serialized data to avoid PHP 8.2 warning on next execution. | ||
*/ | ||
public function __wakeup() { | ||
if ( isset($this->is_beta) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra What if is_beta
is null?
includes/entities/class-fs-user.php
Outdated
@@ -48,6 +48,19 @@ function __construct( $user = false ) { | |||
parent::__construct( $user ); | |||
} | |||
|
|||
/** | |||
* @return void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra I think this should be after the description.
includes/entities/class-fs-user.php
Outdated
* This function 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. | ||
*/ | ||
public function __wakeup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra When the method is public, there's no need to include public
.
includes/entities/class-fs-user.php
Outdated
/** | ||
* @return void | ||
* | ||
* This function removes the deprecated 'is_beta' property from the serialized data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra Please use "method" instead of "function".
includes/entities/class-fs-site.php
Outdated
class FS_Site extends FS_Scope_Entity { | ||
/** | ||
* @var number | ||
*/ | ||
public $site_id; | ||
/** | ||
* @var number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra This should be int
like in the get_unfiltered_site_url()
method (also consistent with the annotation you removed). For entity IDs though, we use number
(like in the FS_Entity
class).
64b9641
to
93d2d11
Compare
This PR needs to be removed, cannot merge directly to master |
[menu] [menu-url] Fixed an issue with the menu URL generation logic.
88730e2
to
f8429f2
Compare
…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. [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
f8429f2
to
cfa06e3
Compare
The report on PHP 8.2 deprecation warnings for dynamic properties highlighted three cases, which this PR addresses:
unserialize
.Changes:
@property FS_Pricing[] $pricing
annotation fromFS_Plugin_Plan
, as the property now exists and the annotation is no longer necessary.$blog_id
property toFS_Site
and removed the corresponding annotation, similar to the previous class.__wakeup
magic method toFS_User
to remove deprecated properties from serialized entities.Added the__unserialize
magic method toFS_User
to manage the result ofunserialize
and prevent warnings. This method only works with public properties and can be removed if the__wakeup
method is sufficient.__unserialize
magic method is detected as non-magic in PHP 7.3 and older byphpcs
.