Skip to content

Built-in server assumes path with dot is a file #10578

Description

@mitgath

Issue is exactly same as https://bugs.php.net/bug.php?id=74061 and same steps to reproduce.

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>

PHP Version

PHP 8.2.2

Operating System

No response

Activity

  1. damianwadley commented on Feb 13, 2023

    @damianwadley
    Member

    #2403 supposedly fixes this but the PR went inactive.

  2. LamentXU123 commented on Oct 9, 2026

    @LamentXU123
    Member

    This is now fixed d7d0d19
    Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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