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

[ Ready ] Upgrade (De)Serialization checks for PHP 7.4 #22

Merged
merged 9 commits into from
Jan 7, 2020
Merged

[ Ready ] Upgrade (De)Serialization checks for PHP 7.4 #22

merged 9 commits into from
Jan 7, 2020

Conversation

lexidor
Copy link
Contributor

@lexidor lexidor commented Jan 5, 2020

Fixes #21

@Ocramius Ocramius modified the milestone: 1.2.0 Jan 5, 2020
@lexidor
Copy link
Contributor Author

lexidor commented Jan 5, 2020

Hi Ocramius. Should we continue the conversation in the issue or start anew here in the PR? I have a question about the red ❌ from travis. English is not m first language. What does it mean and what can I do to turn it into a green ✔️?

@lexidor lexidor changed the title Upgrade (De)Serialization checks for PHP 7.4 [ Ready ] Upgrade (De)Serialization checks for PHP 7.4 Jan 5, 2020
@lexidor
Copy link
Contributor Author

lexidor commented Jan 5, 2020

I don't know what formatter you use.
If this does not match your expectations, feel free to make a formatting commit.

@lexidor
Copy link
Contributor Author

lexidor commented Jan 5, 2020

I would recommend a squashed merge, because there are many intermediary commits.

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: don't worry about the repeated commits though, the merge commit is more relevant to me.

try {
$dont->__unserialize([]);
self::markAsFailed('This method must always throw');
} catch (NonDeserialisableObject $_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be multiple test methods, using $this->expectException(NonDeserialisableObject::class) each


try {
$dont->__serialize();
self::markAsFailed('This method must always throw');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the above: need $this->expectException() and separate tests instead

@@ -23,8 +24,11 @@ final class DontDeserialiseTest extends TestCase
public function testWillThrowOnSerialisationAttempt($className) : void
{
$this->expectException(NonDeserialisableObject::class);

unserialize(\sprintf('O:%s:"%s":0:{}', \strlen($className), $className));
if($className === 'DontTestAsset\\NonDeserialisableImplementingSerializable'){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NonDeserialisableImplementingSerializable::class should be used here

@lexidor lexidor requested a review from Ocramius January 7, 2020 20:59
@Ocramius Ocramius self-assigned this Jan 7, 2020
@Ocramius Ocramius added this to the 1.2.0 milestone Jan 7, 2020
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lexidor!

@Ocramius Ocramius merged commit 714f576 into Roave:master Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ RFC ] Would it be appreciated if I add the new magic methods to Dont(De)serialize?
2 participants