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

Make serialisable? #81

Open
Zegnat opened this issue Aug 18, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@Zegnat
Copy link
Collaborator

commented Aug 18, 2018

Is it an idea to make all of the final objects implement Serializable?

One use-case is for HTTP caches to store request/response objects easily. I ran into this today and ended up requiring zend-diactoros for its Serialization, which just means I end up with two entire PSR-7 implementations loaded at the same time. Any unserialised Nyholm object becomes a Zend object.

The drawback being that we would be adding methods that aren’t specifically defined by PSR-7.

Alternatively this could be spun of just like psr7-server. Which I might work on any way. But did want to throw this up for discussion in the mean time.

@Nyholm

This comment has been minimized.

Copy link
Owner

commented Aug 18, 2018

Hm. I've got this problem as well in the php-http/cache-plugin. See here and here.

Yeah, lets try to see how an implementation would look. You would of course have problem to serialize the Stream.

@Zegnat

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 20, 2018

Yes, and I think that might be the only one PHP’s native serialize() is having problems with.

I wonder how much information should be kept when serialising Stream objects. Is it worth it to try and serialise all available information about the current file pointer, and try to recreate that on deserialisation? If my Stream encloses an fopen() pointing at a file or URL, should that be recreated? Or is it more important to serialise the current contents of said pointer?

I might find some time today to start a branch and do some testing. Would love to hear your first thoughts on the Stream issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.