-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Can't instantiate final class extending ArrayIterator #39
Comments
Is the class being final a required factor?
…On 15 Oct 2017 13:07, "Ciaran McNulty" ***@***.***> wrote:
final class Foo extends ArrayIterator
{
}
return (new \Doctrine\Instantiator\Instantiator())->instantiate(Foo::class);
PHP Fatal error: Uncaught Exception: unserialize(): Error at offset 13 of 14 bytes in /Users/cmcnulty/Documents/Code/phpspec/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php:76
Reproduced on 1.0.5 and 1.1.0 and, not had a chance to debug. Was reported
to PhpSpec as phpspec/phpspec#1124
<phpspec/phpspec#1124>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#39>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakE774PThopb7rIeL4MKZ-Y_s5Exuks5ssedcgaJpZM4P5tar>
.
|
non-final doesn't reproduce the error |
Yep final makes it go back to the unserialization strategy, which seems to have an issue with the ArrayIterator (that is, if I try to unserializing the generated string the |
@ciaranmcnulty This seems to be a hhvm serialization bug. https://3v4l.org/1dYQD |
Waaait, is it that it's working fine but the error handler is catching the notice? |
It is supposed to catch, otherwise internal state may be broken
…On 17 Oct 2017 06:36, "Ciaran McNulty" ***@***.***> wrote:
Waaait, is it that it's working fine but the error handler is catching the
notice?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakDnR52cVKEBbHmQP7ULXiNZ2t017ks5stC7JgaJpZM4P5tar>
.
|
note that with that class that extends ArrayIterator
And This works in hhvm and breaks in PHP
|
@mikeSimonson what is the resolution here? |
I was wondering too :-) If it’s “won’t fix” can you say explicitly so we can plan how we handle this error being thrown? |
Needs clarification. I'm fine with dropping HHVM support and having a workaround just for |
The fact it works differently in HHVM is a red herring IMO the The fact it extends ArrayObject means it somehow can't be deserialized from a string starting with |
As a side note I very much doubt specific serialization formats are at all going to be thought about in terms of BC when PHP changes things :-/ |
Sorry that it wasn't clear enough. In my tests the only way to serialize the sample code in https://3v4l.org/1dYQD to 'O:3:"Foo":0:{}' is to use hhvm. And hhvm (HHVM-3.22.1) can unserialize that on my machine without any notice or error. https://3v4l.org/eX9TO It just failed trying to unserialize hhvm serialization in php. Which seemed like a edge case to me. That's the reason I closed it. But maybe that's not was is going on in your case ? |
I'm not using HHVM, no |
Then, how did you ended up with the |
I was debugging my failure case and it was generated by Doctrine/Instantiator here: |
…ending internal ones (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [VarExporter] fix exporting final serializable classes extending internal ones | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Another edge case, discovered while reading doctrine/instantiator#39 Commits ------- a5bf9b0 [VarExporter] fix exporting final serializable classes extending internal ones
This issue can now be closed 🎉 |
Fixed in #61 |
Reproduced on 1.0.5 and 1.1.0 and, not had a chance to debug. Was reported to PhpSpec as phpspec/phpspec#1124
The text was updated successfully, but these errors were encountered: