Merge pull request #5259 from patricknelson/issue-5251-url-parsing

FIX for #5251 to address minor URL decoding/parsing bug.
This commit is contained in:
Damian Mooyman 2016-04-04 11:35:06 +12:00
commit 5a8db29c5b

View File

@ -94,6 +94,7 @@ if (isset($_GET['url']) && php_sapi_name() !== 'cli-server') {
// Lighttpd and PHP 5.4's built-in webserver use this // Lighttpd and PHP 5.4's built-in webserver use this
} else { } else {
// Get raw URL -- still needs to be decoded below (after parsing out query string).
$url = $_SERVER['REQUEST_URI']; $url = $_SERVER['REQUEST_URI'];
// Querystring args need to be explicitly parsed // Querystring args need to be explicitly parsed
@ -102,6 +103,9 @@ if (isset($_GET['url']) && php_sapi_name() !== 'cli-server') {
$parseQuery($query); $parseQuery($query);
} }
// Decode URL now that it has been separated from query string.
$url = urldecode($url);
// Pass back to the webserver for files that exist // Pass back to the webserver for files that exist
if(php_sapi_name() === 'cli-server' && file_exists(BASE_PATH . $url) && is_file(BASE_PATH . $url)) { if(php_sapi_name() === 'cli-server' && file_exists(BASE_PATH . $url) && is_file(BASE_PATH . $url)) {
return false; return false;