php / php/php-src

HTTP requests (file_get_contents, curl) times out when calling same server listener

オープン
#11,719 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

説明

Description
Issue

When a script makes a HTTP call on Windows to the same host/server listener - it will time out.

Steps to reproduce:
  1. Install PHP 8.2.8 for Windows
  2. Create bug/test.php file with following code:
<?php
echo $_GET['say'] ?? file_get_contents('http://localhost/test.php?say=hello');
  1. cd bug and start a php server in that folder: php -S localhost:80
  2. Try to run the script, it will time out: php test.php

The script will time out, as the file_get_contents never responds.

Expected result

It should echo hello to the console

Further testing

This issue extends further than file_get_contents and php web server - it also affects:

  • curl functions curl_exec etc not just file_get_contents
  • Using php-cgi.exe and nginx on Windows with fastcgi_pass
  • Also tested with Caddy web server, using proxy pass, same issue
Linux/Unix

This doesn't affect linux. Trying the above reproduction steps in Linux will echo hello. It also works as expected when using WSL/Windows Sub System for Linux.

PHP Version

PHP 8.2.8

Operating System

Windows 10

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

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

はじめの一歩

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

調査の方向性

bug/test.php で Windows 上の再現から始め、file_get_contents('http://localhost/test.php?say=hello') と、文書化されている curl_exec のケースを比較します。Windows で PHP 8.2.8 と php -S localhost:80 を使用して再現し、その後、リクエストが完了して hello を返すこと、また Linux/WSL の動作にリグレッションがないことを確認します。

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

評価

技術スタック
php
領域
backend, networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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