Bug #77722 [Asn]: Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the localhost
| From: | nikic@php.net | Date: | Tue, 12 Mar 2019 08:41:26 +0000 |
| Subject: | Bug #77722 [Asn]: Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the localhost | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219919@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77722&edit=1
ID: 77722
Updated by: nikic@php.net
Reported by: josef dot sabl at gmail dot com
Summary: Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the
localhost
Status: Assigned
Type: Bug
Package: Built-in web server
Operating System: Windows
PHP Version: 7.3.3
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
@kalle: The change is correct, but interacts incorrectly with the CLI server code in https://github.com/php/php-src/blob/623911f993f39ebbe75abe2771fc89faf6b15b9b/sapi/cli/php_cli_server.c#L634,
which tries to extract the address simply by taking everything before ":". For IPv6 it
additionally needs to strip the brackets.
Previous Comments:
------------------------------------------------------------------------
[2019-03-11 22:36:40] kalle@php.net
Nikita, can you clarify this behaviour as the original committer of this change? And re-classify it
as a doc bug if indeed so
------------------------------------------------------------------------
[2019-03-11 11:37:58] cmb@php.net
I can confirm the erroneous behavior. It has been introduced with
commit 9501304[1].
[1] <http://git.php.net/?p=php-src.git;a=commit;h=95013042bf85ce1f52e476c5cc301faa97f52a72>
------------------------------------------------------------------------
[2019-03-10 20:34:08] josef dot sabl at gmail dot com
Description:
------------
If run as
php.exe -S localhost:88 the $_SERVER['REMOTE_ADDR'] ===
'[::1]' with the ::1 enclosed in brackets which is invalid and doesn't work
with inet_pton
More info here:
https://github.com/nette/http/issues/152
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77722&edit=1