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

Open
weierophinney opened this issue Dec 31, 2019 · 3 comments
Open

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

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

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.

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

No branches or pull requests

3 participants