Update index.php to serve static files with query strings.

Trim off the query string before attempting to locate the file on the
filesystem. Thanks to Marko Marković for the initial patch.

Fixes #3910
This commit is contained in:
mark_story 2013-07-09 21:01:38 -04:00
parent 542d594b86
commit 2918ae9c7a
2 changed files with 4 additions and 2 deletions

View file

@ -79,7 +79,8 @@ if (!defined('WWW_ROOT')) {
// for built-in server
if (php_sapi_name() == 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) {
$uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, '');
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) {
return false;
}
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);

View file

@ -79,7 +79,8 @@ if (!defined('WWW_ROOT')) {
// for built-in server
if (php_sapi_name() === 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) {
$uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, '');
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) {
return false;
}
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);