php / php/php-src

Built-in server assumes path with dot is a file

オープン
#10,578 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ドキュメント化されている curl URL で動作を再現し、その後、組み込みサーバーのリクエストパス処理を追跡します。この issue では実装ファイルもテストも指定されていません。ドットを含む存在しないパスが、組み込みサーバーの 404 レスポンスを返すのではなく、index.php にルーティングされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。