-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: prioritize headers set by the Response
class
#9235
base: 4.6
Are you sure you want to change the base?
Conversation
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.
Thank you. You've relieved the pain. I fixed this session_cache_limiter(");
in app/Common.php
63a6fc7
to
dd7c025
Compare
|
||
In previous versions, headers set by the ``Response`` class were added to existing | ||
ones - giving no options to change them. That could lead to unexpected behavior when | ||
the same headers were set with mutually exclusive directives. |
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.
Can you elaborate on this "mutually exclusive headers"?
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've added some additional explanations below, in the changelog.
Description
This PR changes the way headers are set. Now headers set by the
Response
class will be prioritized and will replace those set by calling theheader()
function.Why is this important? Without this change, we cannot override the headers set previously with the
header()
function.This is relevant, especially when we work with a session. By default,
session.cache_limiter
is set tonocache
, which is fine for the default setting and will automatically set headers:But we have no option to change these headers, even when we set different
Cache-Control
etc with theResponse
class. If we do so, we end up with two entries forCache-Control
, which will possibly lead to unexpected behavior. We also cannot remove the default headers set bysession.cache_limiter
, because they are set with theheader()
function directly.Headers set with the
Response
class should be prioritized. This is potentially a BC break, but also a bugfix.Ref: #9234
Checklist: