-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
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 ✔️? |
Sorry for the stumbles. I usually get called out by the typechecker for mistakes like this.
I don't know what formatter you use. |
I would recommend a squashed merge, because there are many intermediary commits. |
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.
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 $_) { |
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.
This should be multiple test methods, using $this->expectException(NonDeserialisableObject::class)
each
tests/DontTest/DontSerialiseTest.php
Outdated
|
||
try { | ||
$dont->__serialize(); | ||
self::markAsFailed('This method must always throw'); |
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.
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'){ |
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.
NonDeserialisableImplementingSerializable::class
should be used here
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.
Thanks @lexidor!
Fixes #21