-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Fix notice when HTTP_PHP_AUTH_USER passed without pass #44759
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
38b722f
to
c7a09d5
Compare
I have a mixed feeling about this one. |
But it's not mine code ¯_(ツ)_/¯ Moreover, if PHP_AUTH_PW should always be set, why do we have isset check on line 41 (instead of exception for example)? I guess it worth to make behavior consistent. So either remove ?? on line 41 or add ?? for $headers. @fabpot what do you think? |
symfony/src/Symfony/Component/HttpFoundation/ServerBag.php Lines 37 to 40 in 0d6e859
$headers array.
Same for |
Seems like this was introduced as a workaround for fastcgi with Apache in 2.0: #3551 & symfony/symfony-docs#2529 If we were to refactor this, we should probably take care not to break this workaround? (tbh unless this is a critical fix, I would favor not rewriting this 10 year old code, which is the only way to make sure we don't unintentionally break things) |
the Apache workaround was adding the support for |
@@ -89,6 +89,7 @@ public function getHeaders() | |||
|
|||
// PHP_AUTH_USER/PHP_AUTH_PW | |||
if (isset($headers['PHP_AUTH_USER'])) { | |||
$headers['PHP_AUTH_PW'] = $headers['PHP_AUTH_PW'] ?? ''; |
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.
let's not store the empty string as suggested by stof.
using ($headers['PHP_AUTH_PW'] ?? '')
on the line below should be enough
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.
Done
@stof @nicolas-grekas @fabpot simplified this one by following Nicolas suggestion. Let's make some decision :) |
Thank you @vitman. |
There is a way to pass HTTP_XXX vars. If someone will pass HTTP_PHP_AUTH_USER var without HTTP_PHP_AUTH_PW notice will appear since there is no second isset check against $headers, there is isset only for $this->params