[php-src] Issue #11719: HTTP requests (file_get_contents, curl) times out when calling same server listener
| From: | garygreen | Date: | Mon, 17 Jul 2023 02:01:04 +0000 |
| Subject: | [php-src] Issue #11719: HTTP requests (file_get_contents, curl) times out when calling same server listener | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244977@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11719
Author: garygreen
### 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
<?php
echo $_GET['say'] ?? file_get_contents('http://localhost/test.php?say=hello');
```
3. cd bug and start a php server in that folder: php -S localhost:80
4. 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