Skip to content

Built-in web server prints HTML tags in terminal when address is wrong #7781

Open
@MauricioFauth

Description

@MauricioFauth

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions