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,
|
||||
$headers = null, $cookies = null, &$request = null) {
|
||||
|
||||
Config::nest();
|
||||
|
||||
// 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
|
||||
$oldStage = Versioned::current_stage();
|
||||
@ -217,7 +219,6 @@ class Director implements TemplateGlobalProvider {
|
||||
$existingCookies = isset($_COOKIE) ? $_COOKIE : array();
|
||||
$existingServer = isset($_SERVER) ? $_SERVER : array();
|
||||
|
||||
$existingCookieReportErrors = Config::inst()->get('Cookie', 'report_errors');
|
||||
$existingRequirementsBackend = Requirements::backend();
|
||||
|
||||
Config::inst()->update('Cookie', 'report_errors', false);
|
||||
@ -268,13 +269,14 @@ class Director implements TemplateGlobalProvider {
|
||||
$_COOKIE = $existingCookies;
|
||||
$_SERVER = $existingServer;
|
||||
|
||||
Config::inst()->update('Cookie', 'report_errors', $existingCookieReportErrors);
|
||||
Requirements::set_backend($existingRequirementsBackend);
|
||||
|
||||
// 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
|
||||
Versioned::reading_stage($oldStage);
|
||||
|
||||
Config::unnest();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ class SSViewer {
|
||||
|
||||
/**
|
||||
* @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,
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user