-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Zend\Http\Header\GenericHeader introduces BC break #7295
Conversation
It is not done because of RFC2616, but for Apache. See this comment: #5301 (comment)
|
That may be the case for servers running PHP/Apache, but in this case (and I suspect many others,) the target server is a not PHP/Apache, but a glassfish or tomcat server. i.e. it is the target that dictates the acceptable header name format, not the client, hence my comment "should not change header names under the covers" |
RFC-2616 is dead, and RFC 7230 supercedes it. In looking through the spec, header field names are allowed to be a
In other words, 1 or more
The above clearly notes I'll try and get a patch today so we can have the fix in 2.4. |
- Using rules from [RFC 7230 section 3.2](http://tools.ietf.org/html/rfc7230#section-3.2)
Tests passed against my branch: https://travis-ci.org/weierophinney/zf2/builds/55541093 |
*/ | ||
if (!preg_match('/^[!#-\'*+\-\.0-9A-Z\^-z|~]+$/', $fieldName)) { | ||
if (!preg_match('/^[!#$%&\'*+\-\.\^_`|~0-9a-zA-Z]+$/', $fieldName)) { | ||
throw new Exception\InvalidArgumentException( | ||
'Header name must be a valid RFC 2616 (section 4.2) field-name.' |
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.
Given how RFC 2616 is superceded by RFC 7230 (and various others), maybe we should also just update the exception message as well?
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.
Good point; I'll change it now.
V2.3.4 (and possibly earlier) has a BC break to version 2.2.3 (and possibly later)
Links to: #5301
This is caused by the insistence that underscores are converted to hyphens at L92. It is debatable as to whether RFC2616 actually insists that underscores are not allowed.
Irrespective of that, the code
In addition, it would be useful to include a NonRfc2616Header that can be used in place of GenericHeader with appropriate documentation in the reference guide.