Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for $request->redirect() bug when Kohana:$index_file is activated #210

Closed
wants to merge 2 commits into from

3 participants

@buremba

There was a problem in $request->redirect() when Kohana:$index_file is activated. Kohana:$index_file must be a string value or FALSE not TRUE.

@MazeXD MazeXD commented on the diff
classes/kohana/request.php
@@ -936,13 +937,13 @@ public function redirect($url = '', $code = 302)
if (strpos($referrer, '://') === FALSE)
{
- $referrer = URL::site($referrer, TRUE, Kohana::$index_file);
+ $referrer = URL::site($referrer, TRUE, TRUE);
@MazeXD
MazeXD added a note

I recommend this snippet cause it's valid for both enabled and disabled index_file.

$referrer = URL::site($referrer, TRUE, !empty(Kohana::$index_file));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@MazeXD MazeXD commented on the diff
classes/kohana/request.php
((6 lines not shown))
}
if (strpos($url, '://') === FALSE)
{
// Make the URI into a URL
- $url = URL::site($url, TRUE, Kohana::$index_file);
+ $url = URL::site($url, TRUE, TRUE);
@MazeXD
MazeXD added a note

I recommend this snippet cause it's valid for both enabled and disabled index_file.

$url = URL::site($url, TRUE, !empty(Kohana::$index_file));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Kohana-Builds
Collaborator

Pull request is targeted towards an invalid branch (3.2/master). Usually, this means you have targeted the master, rather than develop branch. Please correct this and try again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 classes/kohana/request.php
View
7 classes/kohana/request.php
@@ -242,7 +242,8 @@ public static function factory($uri = TRUE, HTTP_Cache $cache = NULL, $injected_
/**
* Automatically detects the URI of the main request using PATH_INFO,
- * REQUEST_URI, PHP_SELF or REDIRECT_URL.
+ * REQUEST_URI, PHP_SELF or
+ _URL.
*
* $uri = Request::detect_uri();
*
@@ -936,13 +937,13 @@ public function redirect($url = '', $code = 302)
if (strpos($referrer, '://') === FALSE)
{
- $referrer = URL::site($referrer, TRUE, Kohana::$index_file);
+ $referrer = URL::site($referrer, TRUE, TRUE);
@MazeXD
MazeXD added a note

I recommend this snippet cause it's valid for both enabled and disabled index_file.

$referrer = URL::site($referrer, TRUE, !empty(Kohana::$index_file));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
if (strpos($url, '://') === FALSE)
{
// Make the URI into a URL
- $url = URL::site($url, TRUE, Kohana::$index_file);
+ $url = URL::site($url, TRUE, TRUE);
@MazeXD
MazeXD added a note

I recommend this snippet cause it's valid for both enabled and disabled index_file.

$url = URL::site($url, TRUE, !empty(Kohana::$index_file));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
if (($response = $this->response()) === NULL)
Something went wrong with that request. Please try again.