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
Improve getScheme on Zend_Controller_Request_Http #1872
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.
With PHP 8.1, if $this->getServer('HTTPS')
return null, it will crash.
strtolower(null)
: PHP Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
Not sure if this case can happen.
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.
strtolower requires a string, but we could get a null here as of
magento-lts/app/code/core/Zend/Controller/Request/Http.php
Lines 345 to 361 in b6cc7b2
/** | |
* Retrieve a member of the $_SERVER superglobal | |
* | |
* If no $key is passed, returns the entire $_SERVER array. | |
* | |
* @param string $key | |
* @param mixed $default Default value to use if key not found | |
* @return mixed Returns null if key does not exist | |
*/ | |
public function getServer($key = null, $default = null) | |
{ | |
if (null === $key) { | |
return $_SERVER; | |
} | |
return (isset($_SERVER[$key])) ? $_SERVER[$key] : $default; | |
} |
55e20e6
Description (*)
Some web servers (for example the local web server of the Symfony CLI) puts the value
On
(and noton
) in the$_SERVER['HTTPS']
super global.With this PR the
Zend_Controller_Request_Http::getScheme
properly returns the HTTPS scheme in such situations.Manual testing scenarios (*)
symfony server:start
https://127.0.0.1:8000/
base URL for both secure and unsecureContribution checklist (*)