mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Don't let Director::test() clobber current stage
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63825 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
cf5b6342df
commit
7741fdb155
@ -147,6 +147,10 @@ class Director {
|
||||
* @uses Controller::run() Controller::run() handles the page logic for a Director::direct() call.
|
||||
*/
|
||||
function test($url, $postVars = null, $session = null, $httpMethod = null, $body = null, $headers = null) {
|
||||
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
||||
// Really, it's some inapproriate coupling and should be resolved by making less use of statics
|
||||
$oldStage = Versioned::current_stage();
|
||||
|
||||
if(!$httpMethod) $httpMethod = $postVars ? "POST" : "GET";
|
||||
|
||||
$getVars = array();
|
||||
@ -177,6 +181,10 @@ class Director {
|
||||
$_GET = $existingGetVars;
|
||||
$_POST = $existingPostVars;
|
||||
$_SESSION = $existingSessionVars;
|
||||
|
||||
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
||||
// Really, it's some inapproriate coupling and should be resolved by making less use of statics
|
||||
Versioned::reading_stage($oldStage);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user