From 2ccd4c06ee5b3e1a2a541ba1a5814c11ba05dd70 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Fri, 30 Nov 2007 01:24:02 +0000 Subject: [PATCH] Ticket #49: Factfinder: "Finish" doesn't redirect to "thank you" git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@46044 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/Controller.php | 4 ++++ core/control/Director.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/control/Controller.php b/core/control/Controller.php index da73b98a5..9c80be27b 100644 --- a/core/control/Controller.php +++ b/core/control/Controller.php @@ -422,6 +422,10 @@ class Controller extends ViewableData { * Handle redirection */ function redirect($url) { + if($this->response->getHeader('Location')) { + user_error("Already directed to " . $this->response->getHeader('Location') . "; now trying to direct to $url", E_USER_ERROR); + } + // Attach site-root to relative links, if they have a slash in them if($url == "" || $url[0] == '?' || (substr($url,0,4) != "http" && $url[0] != "/" && strpos($url,'/') !== false)){ $url = Director::baseURL() . $url; diff --git a/core/control/Director.php b/core/control/Director.php index 12383b3a9..1ab301794 100644 --- a/core/control/Director.php +++ b/core/control/Director.php @@ -240,7 +240,7 @@ class Director { * @return string If redirect() has been called, it will return the URL redirected to. Otherwise, it will return null; */ static function redirected_to() { - Controller::curr()->redirectedTo(); + return Controller::curr()->redirectedTo(); } /*