Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Refs #4375 - Parameter order for HTTP/Controller::redirect() #233

Merged
merged 1 commit into from

5 participants

@kemo
Collaborator
@Kohana-Builds
Collaborator

Build Scheduled

@shadowhand shadowhand merged commit f15dd11 into kohana:3.3/develop
@kiall

Heh - I had this cherry-picked and was writing tests for it ;) Was wondering why I couldn't push anymore!

@zombor
Owner

This wasn't ready for merge. There were no test changes.

@kiall

Its okay - I added the tests in another commit..

@shadowhand
Owner

Jenkins said the build had passed, so I assumed it was safe...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2012
  1. @kemo
This page is out of date. Refresh to see the latest.
View
6 classes/Kohana/Controller.php
@@ -118,13 +118,13 @@ public function after()
*
* Proxies to the [HTTP::redirect] method.
*
- * @param int $code HTTP Status code to use for the redirect
* @param string $uri URI to redirect to
+ * @param int $code HTTP Status code to use for the redirect
* @throws HTTP_Exception
*/
- public static function redirect($code = 302, $uri = '')
+ public static function redirect($uri = '', $code = 302)
{
- return HTTP::redirect($code, $uri);
+ return HTTP::redirect($uri, $code);
}
/**
View
4 classes/Kohana/HTTP.php
@@ -24,11 +24,11 @@
/**
* Issues a HTTP redirect.
*
- * @param int $code HTTP Status code to use for the redirect
* @param string $uri URI to redirect to
+ * @param int $code HTTP Status code to use for the redirect
* @throws HTTP_Exception
*/
- public static function redirect($code = 302, $uri = '')
+ public static function redirect($uri = '', $code = 302)
{
throw HTTP_Exception::factory($code)->location($uri);
}
View
4 guide/kohana/mvc/controllers.md
@@ -128,7 +128,7 @@ A user login action.
// Try to login
if (Auth::instance()->login($this->request->post('username'), $this->request->post('password')))
{
- $this->redirect(302, 'home');
+ $this->redirect('home', 302);
}
$view->errors = 'Invalid email or password';
@@ -154,7 +154,7 @@ You can check what action has been requested (via `$this->request->action`) and
// If this user doesn't have the admin role, and is not trying to login, redirect to login
if ( ! Auth::instance()->logged_in('admin') AND $this->request->action !== 'login')
{
- $this->redirect(302, 'admin/login');
+ $this->redirect('admin/login', 302);
}
}
View
2  guide/kohana/security/validation.md
@@ -228,7 +228,7 @@ Next, we need a controller and action to process the registration, which will be
$user->register($post);
// Always redirect after a successful POST to prevent refresh warnings
- $this->redirect(302, 'user/profile');
+ $this->redirect('user/profile', 302);
}
// Validation failed, collect the errors
View
4 guide/kohana/upgrading.md
@@ -31,11 +31,11 @@ Examples:
Redirects are no longer issued against the [Request] object. The new syntax from inside a controler is:
- $this->redirect(302, 'http://www.google.com');
+ $this->redirect('http://www.google.com', 302);
or from outside a controller:
- HTTP::redirect(302, 'http://www.google.com');
+ HTTP::redirect('http://www.google.com', 302);
## Custom Error Pages (HTTP 500, 404, 403, 401 etc)
Something went wrong with that request. Please try again.