-
Notifications
You must be signed in to change notification settings - Fork 59
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
Supporting empty Content-Length headers by ignoring them. #73
Conversation
if (null === $contentLength) { | ||
return stream_get_contents($body); | ||
} else { | ||
if (is_int($contentLength) || ctype_digit($contentLength)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this lib already depend on the ctype ext?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternativ could be a cast to int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. I didn't realize it was an extension. I'll add it to the require
list to make sure this is captured
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cast to int would turn an empty string into a 0, and instead I want an invalid value to be ignored altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$i = (int) $contentLength;
If ($i > 0 && $i != $contentLength)
...
But as you already depend on ctypes its fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah not a bad one =)
Fixes #72