-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove PHP 8.1 deprecated warnings #41
Conversation
Signed-off-by: Witold Wasiczko <[email protected]>
Signed-off-by: Witold Wasiczko <[email protected]>
482ee23
to
039f19a
Compare
Co-authored-by: Abdul Malik Ikhsan <[email protected]>
Thank you @snapshotpl |
public function __serialize() | ||
{ | ||
return serialize($this->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.
@snapshotpl Shouldn't this return an array instead of a serialized string? From https://www.php.net/manual/language.oop5.magic.php#object.serialize:
public __serialize(): array
public __unserialize(array $data): void
serialize() checks if the class has a function with the magic name __serialize(). If so, that function is executed prior to any serialization. It must construct and return an associative array of key/value pairs that represent the serialized form of the object. If no array is returned a TypeError will be thrown.
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.
@driehle
Good catch! 👍
Please create an issue report or a pull request for this problem. Thanks in advance!
public function __unserialize($data) | ||
{ | ||
$this->data = unserialize($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.
See above, $data
should be an array at this point, i.e. no need to call unserialize()
.
Description
Remove deprecated warnings when run phpunit and developer-tools itself.