Skip to content
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

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

snapshotpl
Copy link
Member

Q A
Documentation no
Bugfix no
BC Break yes
New Feature no
RFC no
QA yes

Description

Remove deprecated warnings when run phpunit and developer-tools itself.

Signed-off-by: Witold Wasiczko <[email protected]>
@snapshotpl snapshotpl changed the title Remove 8.1 deprecated warnings Remove PHP 8.1 deprecated warnings Nov 26, 2021
@snapshotpl snapshotpl changed the base branch from 2.3.x to 2.2.x November 26, 2021 09:47
@snapshotpl snapshotpl added the Bug Something isn't working label Nov 26, 2021
@snapshotpl snapshotpl added this to the 2.2.1 milestone Nov 26, 2021
Signed-off-by: Witold Wasiczko <[email protected]>
@snapshotpl snapshotpl force-pushed the remove-8.1-deprecations branch from 482ee23 to 039f19a Compare November 29, 2021 13:51
@snapshotpl snapshotpl changed the base branch from 2.2.x to 2.3.x November 29, 2021 13:51
@snapshotpl snapshotpl modified the milestones: 2.2.1, 2.3.0 Dec 6, 2021
.gitignore Outdated Show resolved Hide resolved
Co-authored-by: Abdul Malik Ikhsan <[email protected]>
@samsonasik samsonasik merged commit 6e0efe8 into laminas:2.3.x Dec 7, 2021
@samsonasik
Copy link
Member

Thank you @snapshotpl

Comment on lines +20 to +23
public function __serialize()
{
return serialize($this->data);
}
Copy link

@driehle driehle Dec 16, 2021

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.

Copy link
Member

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!

Comment on lines +34 to 37
public function __unserialize($data)
{
$this->data = unserialize($data);
}
Copy link

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants