Affected page
https://www.php.net/manual/en/context.http.php
Issue description
follow_location int
Follow Location header redirects. Set to 0 to disable.
Defaults to 1.
Steps to reproduce
If http.follow_location is set, it determines whether redirects are followed never or always. When it is not set, redirects are followed on status code 300, 301, 302, 303, 307 and 308.
Not setting it is different then setting it to 1. So it is incorrect to say that the default value is 1.
ext/standard/http_fopen_wrapper.c
/* Check if the location should be followed. */
if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) {
header_info->follow_location = zend_is_true(tmpzval);
} else if (!((response_code >= 300 && response_code < 304)
|| 307 == response_code || 308 == response_code)) {
/* The redirection should not be automatic if follow_location is not set and
* response_code not in (300, 301, 302, 303 and 307)
* see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1
* RFC 7238 defines 308: http://tools.ietf.org/html/rfc7238 */
header_info->follow_location = false;
}
Suggested fix
No response
Affected page
https://www.php.net/manual/en/context.http.php
Issue description
follow_location int
Follow Location header redirects. Set to 0 to disable.
Defaults to 1.
Steps to reproduce
If http.follow_location is set, it determines whether redirects are followed never or always. When it is not set, redirects are followed on status code 300, 301, 302, 303, 307 and 308.
Not setting it is different then setting it to 1. So it is incorrect to say that the default value is 1.
ext/standard/http_fopen_wrapper.c
Suggested fix
No response