-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Description
Bug Report: Built-in PHP Server misinterprets IPv6 address with port
The following command:
php -S "[1234:1234:1234:1234::4321]:8080"
Resulted in this output:
Failed to listen on 1234:1234:1234:1234::4321:8080 (reason: Cannot assign requested address)
But I expected this output instead:
Server listening on http://[1234:1234:1234:1234::4321]:8080
Description:
When passing an IPv6 address (not [::]) with a port to the built-in PHP server, it incorrectly parses the address and treats the port as part of the IPv6 string. This leads to an invalid address format and the server fails to start.
This is a parsing issue that should be corrected to properly support IPv6 notation with ports, as per standard URI syntax.
Standards Reference:
According to RFC 3986 and RFC 5952, IPv6 addresses in URLs must be enclosed in square brackets when followed by a port number. This ensures that the colon used in the port specification is not confused with the colons in the IPv6 address itself.
Why this matters:
IPv6 is no longer a future concept—it is the present. Since RFC 8200 officially standardized IPv6 in July 2017, global adoption has surged. As of now, nearly 50% of global internet traffic uses IPv6.
This is not an optional feature anymore. Proper IPv6 support is essential for modern development environments. PHP, as one of the most widely used programming languages in the world, should handle IPv6 robustly and correctly—especially in something as fundamental as the built-in development server.
PHP Version
PHP 8.4.11 (cli) (built: Jul 31 2025 15:55:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.11, Copyright (c) Zend Technologies
Operating System
Linux Arch (6.12.41-1-lts)