mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT allow Director::test() to cope with absolute URIs
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81680 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6a52153b9f
commit
39309b1e9a
@ -179,12 +179,6 @@ class Director {
|
|||||||
|
|
||||||
if(!$httpMethod) $httpMethod = ($postVars || is_array($postVars)) ? "POST" : "GET";
|
if(!$httpMethod) $httpMethod = ($postVars || is_array($postVars)) ? "POST" : "GET";
|
||||||
|
|
||||||
$urlWithQuerystring = $url;
|
|
||||||
if(strpos($url, '?') !== false) {
|
|
||||||
list($url, $getVarsEncoded) = explode('?', $url, 2);
|
|
||||||
parse_str($getVarsEncoded, $getVars);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$session) $session = new Session(null);
|
if(!$session) $session = new Session(null);
|
||||||
|
|
||||||
// Back up the current values of the superglobals
|
// Back up the current values of the superglobals
|
||||||
@ -200,6 +194,19 @@ class Director {
|
|||||||
Cookie::set_report_errors(false);
|
Cookie::set_report_errors(false);
|
||||||
Requirements::set_backend(new Requirements_Backend());
|
Requirements::set_backend(new Requirements_Backend());
|
||||||
|
|
||||||
|
// Handle absolute URLs
|
||||||
|
if (@parse_url($url, PHP_URL_HOST) != '') {
|
||||||
|
$bits = parse_url($url);
|
||||||
|
$_SERVER['HTTP_HOST'] = $bits['host'];
|
||||||
|
$url = Director::makeRelative($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
$urlWithQuerystring = $url;
|
||||||
|
if(strpos($url, '?') !== false) {
|
||||||
|
list($url, $getVarsEncoded) = explode('?', $url, 2);
|
||||||
|
parse_str($getVarsEncoded, $getVars);
|
||||||
|
}
|
||||||
|
|
||||||
// Replace the superglobals with appropriate test values
|
// Replace the superglobals with appropriate test values
|
||||||
$_REQUEST = array_merge((array)$getVars, (array)$postVars);
|
$_REQUEST = array_merge((array)$getVars, (array)$postVars);
|
||||||
$_GET = (array)$getVars;
|
$_GET = (array)$getVars;
|
||||||
|
Loading…
Reference in New Issue
Block a user