[php-src] Issue #12604: Built-in server assumes static content if there's a "." in the URL
| From: | asmecher | Date: | Fri, 03 Nov 2023 14:47:59 +0000 |
| Subject: | [php-src] Issue #12604: Built-in server assumes static content if there's a "." in the URL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245733@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12604
Author: asmecher
### Description
1. Use the built-in server
2. Place a
phpinfo() script with the following code in a file called
index.php in the server's root:
```php
<?php phpinfo();
```
3. Try requesting a URL with PATH_INFO data:
http://localhost:8081/anything/works/here`
You should see a valid phpinfo page with the anything/works/here provided as path
info data, and the index.php wrapper appropriately identified as the handling script:

4. Now, edit the URL to add a ., e.g.:
http://localhost:8081/anything/works/he.re`
Loading this will give a 404 page:

URLs with a . in the PATH_INFO data should work equally well as those
without.
[The documentation](https://www.php.net/manual/en/features.commandline.webserver.php) does not
mention this quirk:

...but the code appears to look specifically for a .:
https://github.com/php/php-src/blob/a66c926b6859fb5aaf47d400c7a2c31ba12749c5/sapi/cli/php_cli_server.c#L1458
### PHP Version
PHP 8.2.12
### Operating System
Ubuntu 20.04