php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74061 Built-in server assumes path with dot is a file
Submitted: 2017-02-08 14:06 UTC Modified: 2023-02-13 18:22 UTC
Votes:9
Avg. Score:4.1 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:2 (33.3%)
From: aljosha dot papsch at vinexus dot eu Assigned:
Status: Duplicate Package: Built-in web server
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-02-08 14:06 UTC] aljosha dot papsch at vinexus dot eu
Description:
------------
If the path contains a dot, built-in server assumes it's a file and tries to serve it. Try the test script with the following URLs. Last one will return 404 response but should route to index.php.

$ curl http://localhost:8000/
$ curl http://localhost:8000/O_o
$ curl http://localhost:8000/O.o




Test script:
---------------
<?php
echo "hello, world\n";

Expected result:
----------------
hello, world

Actual result:
--------------
<!doctype html><html><head><title>404 Not Found</title><style>
body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; }
h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; }
h1, p { padding-left: 10px; }
code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;}
</style>
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/ba.z</code> was not found on this server.</p></body></html>

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-04 17:20 UTC] remi@php.net
Should have check for this bug..

So duplicate of #74205, fixed by https://github.com/php/php-src/pull/2403
 [2023-02-13 18:22 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2023-02-13 18:22 UTC] requinix@php.net
Closed in favor of https://github.com/php/php-src/issues/10578
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC