HTTP requests (file_get_contents, curl) times out when calling same server listener
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
Issue
When a script makes a HTTP call on Windows to the same host/server listener - it will time out.
Steps to reproduce:
- Install PHP 8.2.8 for Windows
- Create
bug/test.phpfile with following code:
<?php
echo $_GET['say'] ?? file_get_contents('http://localhost/test.php?say=hello');
cd bugand start a php server in that folder:php -S localhost:80- 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_execetc not justfile_get_contents - Using
php-cgi.exeand nginx on Windows withfastcgi_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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione su Windows in bug/test.php e confronta file_get_contents('http://localhost/test.php?say=hello') con i casi documentati di curl_exec. Riproduci il problema usando PHP 8.2.8 e php -S localhost:80 su Windows, quindi verifica che la richiesta venga completata e restituisca hello senza causare regressioni nel comportamento di Linux/WSL.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- backend, networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100