Permalink
Browse files

FIX Config isolation in Director::test()

  • Loading branch information...
1 parent 828ac7f commit 7121fc3f85fc51e7ad6c8b3e50fc09b5cc6b5905 @chillu chillu committed Mar 27, 2013
Showing with 5 additions and 3 deletions.
  1. +4 −2 control/Director.php
  2. +1 −1 view/SSViewer.php
View
@@ -200,6 +200,8 @@ public static function direct($url, DataModel $model) {
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 @@ public static function test($url, $postVars = null, $session = null, $httpMethod
$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,12 +269,13 @@ public static function test($url, $postVars = null, $session = null, $httpMethod
$_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;
}
View
@@ -579,7 +579,7 @@ public static function get_source_file_comments() {
/**
* @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

0 comments on commit 7121fc3

Please sign in to comment.