mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
542d594b86
commit
2918ae9c7a
2 changed files with 4 additions and 2 deletions
|
@ -79,7 +79,8 @@ if (!defined('WWW_ROOT')) {
|
||||||
|
|
||||||
// for built-in server
|
// for built-in server
|
||||||
if (php_sapi_name() == 'cli-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;
|
return false;
|
||||||
}
|
}
|
||||||
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
|
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
|
||||||
|
|
|
@ -79,7 +79,8 @@ if (!defined('WWW_ROOT')) {
|
||||||
|
|
||||||
// for built-in server
|
// for built-in server
|
||||||
if (php_sapi_name() === 'cli-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;
|
return false;
|
||||||
}
|
}
|
||||||
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
|
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
|
||||||
|
|
Loading…
Reference in a new issue