go to bug id or search bugs for
I'm not sure whether this is a bug in the web server or in PHP itself, but trying to access $_SERVER when PHP has received an invalid request such as:
GET www.example.com:80 HTTP/1.1
Makes the built-in web server segfault.
1. Create a test.php file containing this line:
2. Start the built-in web server on this file:
php -S localhost:8888 test.php
3. Run this PHP code to send an invalid HTTP request:
$fp = fsockopen('localhost', 8888);
fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n");
while (! feof($fp)) echo fread($fp, 1024);
The web server will segfault.
Add a Patch
Add a Pull Request
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.