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

getHeaderLine() MUST return a string #537

Merged
merged 1 commit into from Apr 27, 2015

Conversation

weierophinney
Copy link
Contributor

Slight change: if the header does not exist, instead of returning null, return an empty string. This is more consistent with getHeader() (which returns an empty array in the same situation), and with the UriInterface (where absence of a value returns an empty string).

Slight change: if the header does not exist, instead of returning null, return an empty string. This is more consistent with `getHeader()` (which returns an empty array in the same situation), and with the `UriInterface` (where absence of a value returns an empty string).
@weierophinney
Copy link
Contributor Author

@Crell — please review!

@Crell
Copy link
Contributor

Crell commented Apr 27, 2015

+1!

@weierophinney
Copy link
Contributor Author

@simensen and/or @pmjones — ready to merge!

simensen added a commit that referenced this pull request Apr 27, 2015
@simensen simensen merged commit 283d291 into php-fig:master Apr 27, 2015
@weierophinney weierophinney deleted the hotfix/header-line-empty branch April 27, 2015 19:32
@Tobion
Copy link
Contributor

Tobion commented May 5, 2015

Are you sure there is no semantical difference between an absense of a header and the presence of a header with an empty value? I can image there are, e.g. a custom Debug header that is only checked if it is present like a boolean header similar to html attributes. Now there would be no way anymore to distinguish that.

@Tobion
Copy link
Contributor

Tobion commented May 5, 2015

The comparison with UriInterface is not valid because in URI terms there is no difference between null and '', both mean it's not there. But for headers it's different.

@Tobion
Copy link
Contributor

Tobion commented May 5, 2015

I figured there is also a hasHeader method which can be used for such "boolean" headers. So this change here is ok and does not prevent this use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants