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

Stream::getMetadata() does not handle detached resource #22

Closed
weierophinney opened this issue Dec 31, 2019 · 3 comments · Fixed by #195
Closed

Stream::getMetadata() does not handle detached resource #22

weierophinney opened this issue Dec 31, 2019 · 3 comments · Fixed by #195
Labels
Bug Something isn't working Help Wanted
Milestone

Comments

@weierophinney
Copy link
Member

What must return Stream::getMetadata() if resource is detached?

P.S.:
What should be the level of expectation of the error?
if i use:

$stream->write(function () {});

Do I have to expects an RutimeException?


Originally posted by @easy-system at zendframework/zend-diactoros#168

@Xerkus Xerkus added the Bug Something isn't working label May 2, 2023
@Xerkus Xerkus changed the title Stream::getMetadata() Stream::getMetadata() does not handle detached resource May 2, 2023
@Xerkus
Copy link
Member

Xerkus commented May 2, 2023

On detached resource getMetadata() should return null as there is no metadata to be had.

@boesing
Copy link
Member

boesing commented May 2, 2023

@Xerkus as per PSR-7, getMetadata without a specific argument has to return an associative array. I'd say, in case of detached resources, that should be just an empty array, no?

@Xerkus
Copy link
Member

Xerkus commented May 2, 2023

@boesing you are right. It should be empty array. I misread the docblock. Null is only expected when specific key is not found.

@Xerkus Xerkus added this to the 3.4.0 milestone Sep 10, 2024
@Xerkus Xerkus linked a pull request Sep 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants