mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Config isolation in Director::test()
This commit is contained in:
parent
828ac7fe4f
commit
7121fc3f85
@ -200,6 +200,8 @@ class Director implements TemplateGlobalProvider {
|
|||||||
public static function test($url, $postVars = null, $session = null, $httpMethod = null, $body = null,
|
public static function test($url, $postVars = null, $session = null, $httpMethod = null, $body = null,
|
||||||
$headers = null, $cookies = null, &$request = null) {
|
$headers = null, $cookies = null, &$request = null) {
|
||||||
|
|
||||||
|
Config::nest();
|
||||||
|
|
||||||
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
||||||
// Really, it's some inappropriate coupling and should be resolved by making less use of statics
|
// Really, it's some inappropriate coupling and should be resolved by making less use of statics
|
||||||
$oldStage = Versioned::current_stage();
|
$oldStage = Versioned::current_stage();
|
||||||
@ -217,7 +219,6 @@ class Director implements TemplateGlobalProvider {
|
|||||||
$existingCookies = isset($_COOKIE) ? $_COOKIE : array();
|
$existingCookies = isset($_COOKIE) ? $_COOKIE : array();
|
||||||
$existingServer = isset($_SERVER) ? $_SERVER : array();
|
$existingServer = isset($_SERVER) ? $_SERVER : array();
|
||||||
|
|
||||||
$existingCookieReportErrors = Config::inst()->get('Cookie', 'report_errors');
|
|
||||||
$existingRequirementsBackend = Requirements::backend();
|
$existingRequirementsBackend = Requirements::backend();
|
||||||
|
|
||||||
Config::inst()->update('Cookie', 'report_errors', false);
|
Config::inst()->update('Cookie', 'report_errors', false);
|
||||||
@ -268,13 +269,14 @@ class Director implements TemplateGlobalProvider {
|
|||||||
$_COOKIE = $existingCookies;
|
$_COOKIE = $existingCookies;
|
||||||
$_SERVER = $existingServer;
|
$_SERVER = $existingServer;
|
||||||
|
|
||||||
Config::inst()->update('Cookie', 'report_errors', $existingCookieReportErrors);
|
|
||||||
Requirements::set_backend($existingRequirementsBackend);
|
Requirements::set_backend($existingRequirementsBackend);
|
||||||
|
|
||||||
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
// These are needed so that calling Director::test() doesnt muck with whoever is calling it.
|
||||||
// Really, it's some inappropriate coupling and should be resolved by making less use of statics
|
// Really, it's some inappropriate coupling and should be resolved by making less use of statics
|
||||||
Versioned::reading_stage($oldStage);
|
Versioned::reading_stage($oldStage);
|
||||||
|
|
||||||
|
Config::unnest();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ class SSViewer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
* @var string Use the theme. Set to FALSE in order to disable themes,
|
* @var boolean Use the theme. Set to FALSE in order to disable themes,
|
||||||
* which can be useful for scenarios where theme overrides are temporarily undesired,
|
* which can be useful for scenarios where theme overrides are temporarily undesired,
|
||||||
* such as an administrative interface separate from the website theme.
|
* such as an administrative interface separate from the website theme.
|
||||||
* It retains the theme settings to be re-enabled, for example when a website content
|
* It retains the theme settings to be re-enabled, for example when a website content
|
||||||
|
Loading…
Reference in New Issue
Block a user