mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fixed bug #77722
This commit is contained in:
parent
95c8f67a4c
commit
a7739be22f
4
NEWS
4
NEWS
@ -9,6 +9,10 @@ PHP NEWS
|
||||
. Fixed bug #77345 (Stack Overflow caused by circular reference in garbage
|
||||
collection). (Alexandru Patranescu, Nikita, Dmitry)
|
||||
|
||||
- CLI Server:
|
||||
. Fixed bug #77722 (Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the
|
||||
localhost). (Nikita)
|
||||
|
||||
- Apache2Handler:
|
||||
. Fixed bug #77648 (BOM in sapi/apache2handler/php_functions.c). (cmb)
|
||||
|
||||
|
@ -637,10 +637,14 @@ static void sapi_cli_server_register_variables(zval *track_vars_array) /* {{{ */
|
||||
char *tmp;
|
||||
if ((tmp = strrchr(client->addr_str, ':'))) {
|
||||
char addr[64], port[8];
|
||||
const char *addr_start = client->addr_str, *addr_end = tmp;
|
||||
if (addr_start[0] == '[') addr_start++;
|
||||
if (addr_end[-1] == ']') addr_end--;
|
||||
|
||||
strncpy(port, tmp + 1, 8);
|
||||
port[7] = '\0';
|
||||
strncpy(addr, client->addr_str, tmp - client->addr_str);
|
||||
addr[tmp - client->addr_str] = '\0';
|
||||
strncpy(addr, addr_start, addr_end - addr_start);
|
||||
addr[addr_end - addr_start] = '\0';
|
||||
sapi_cli_server_register_variable(track_vars_array, "REMOTE_ADDR", addr);
|
||||
sapi_cli_server_register_variable(track_vars_array, "REMOTE_PORT", port);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user