Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make sure post controller, and post system hooks get called on a redirect() #1162

Closed
wants to merge 1 commit into from

2 participants

@chrisguiney

At the moment, redirect() will completely overlook the possibility of a post controller/post system hooks

@narfbg
Owner

redirect() (with the use of exit) terminates script execution at any point of the application run flow. Skipping e.g. views, but running post hooks doesn't make sense, and while it's highly unlikely that somebody would want to use redirect() inside these hooks - it would be a disaster.
You can always create your own helper function to achieve the effect that you want, but it's not going into CI.

@narfbg narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2012
  1. @chrisguiney

    Make sure post controller, and post system hooks get called on a redi…

    chrisguiney authored
    …rect()(cherry picked from commit 58ced55)
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 system/helpers/url_helper.php
View
6 system/helpers/url_helper.php
@@ -553,6 +553,12 @@ function redirect($uri = '', $method = 'auto', $http_response_code = 302)
header('Location: '.$uri, TRUE, $http_response_code);
break;
}
+
+ //We're doing a premature exit, make sure any post controller/post system hooks get called
+ $hooks =& load_class('Hooks', 'core');
+ $hooks->_call_hook('post_controller');
+ $hooks->_call_hook('post_system');
+
exit;
}
}
Something went wrong with that request. Please try again.