Eventually in the console or cmd the error Invalid request (Unexpected EOF)
appears, note that I understand what EOF means, which is E nd O f F ile, but I do not understand why exactly this occurs.
At first I thought it was something related to conflicts with IPV6, but I'm not sure of this now, notice that I'm using a routing script, the result is something like:
PHP 5.6.14 Development Server started at Tue Oct 04 10:39:40 2016 Listening on http://localhost:9000 Document root is C:\Users\Guilherme\Documents\GitHub\inphinit Press Ctrl-C to quit. [Tue Oct 04 10:40:13 2016] ::1:62748 Invalid request (Unexpected EOF) [Tue Oct 04 10:40:13 2016] ::1:62749 Invalid request (Unexpected EOF)
Note that the server does not stop working, I'm just curious to understand why this
The command looks like this:
php -S localhost:9000 router.php
It looks like this:
<?php
$serverPath = realpath(dirname(__FILE__) . '/../../');
$serverPath = rtrim(strtr($serverPath, '\', '/'), '/') . '/';
$path = urldecode(preg_replace('#\?(.*)$#', '', $_SERVER['REQUEST_URI']));
$path = ltrim($path, '/');
if (
$path !== '' &&
$path !== '/' &&
strcasecmp($path, 'system') !== 0 &&
stripos($path, 'system/') !== 0 &&
file_exists($serverPath . $path)
) {
return false;
}
echo 'Oi';
The problem seems to only occur when I use a routing script, I noticed the problem in windows, but I did not get to test in unix-like environments and I do not know if this happens in them,
- Windows 8.1 x64
- PHP 5.6.14 x64 and x86
I tested two different machines