Built-in web server prints HTML tags in terminal when address is wrong
Open
Nobody has claimed this yet.
Feature
SAPI: cli_server
Status: Verified
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
I tried to start the built-in web server, but I mistyped the address and then the PHP cli printed HTML tags in the terminal.
- php -S 0.0.0.0:8080
+ php -S 0.0..0:8080
Resulted in this output:
$ php -S 0.0..0:8080
[Wed Dec 15 11:54:39 2021] PHP Warning: Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in Unknown on line 0
<br />
<b>Warning</b>: Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in <b>Unknown</b> on line <b>0</b><br />
[Wed Dec 15 11:54:39 2021] Failed to listen on 0.0..0:8080 (reason: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known)
But I expected this output instead:
$ php -S 0.0..0:8080
[Wed Dec 15 12:01:43 2021] PHP Warning: Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in Unknown on line 0
[Wed Dec 15 12:01:43 2021] Failed to listen on 0.0..0:8080 (reason: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known)
PHP version:
PHP 8.1.0 (cli) (built: Nov 25 2021 20:48:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
with blackfire v1.72.0~linux-x64-non_zts81, https://blackfire.io, by Blackfire
PHP Version
8.1.0
Operating System
Debian Bookworm
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the documented php -S 0.0..0:8080 command and inspect the built-in web server's error-reporting path. Done means the invalid-address warning remains readable in the terminal without emitting HTML tags, while the existing failure message is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100