summaryrefslogtreecommitdiffstats
path: root/system/core/URI.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/URI.php')
-rw-r--r--system/core/URI.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/system/core/URI.php b/system/core/URI.php
index 6a8b1a5ac..72f293c18 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -165,11 +165,8 @@ class CI_URI {
*/
protected function _set_uri_string($str)
{
- // Filter out control characters
- $str = remove_invisible_characters($str, FALSE);
-
- // If the URI contains only a slash we'll kill it
- $this->uri_string = ($str === '/') ? '' : $str;
+ // Filter out control characters and trim slashes
+ $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
}
// --------------------------------------------------------------------
@@ -436,9 +433,9 @@ class CI_URI {
/**
* Generate a key value pair from the URI string or Re-routed URI string
*
- * @param int the starting segment number
- * @param array an array of default values
- * @param string which array we should use
+ * @param int $n = 3 the starting segment number
+ * @param array $default = array() an array of default values
+ * @param string $which = 'segment' which array we should use
* @return array
*/
protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
@@ -448,9 +445,11 @@ class CI_URI {
return $default;
}
- if (isset($this->keyval[$n]))
+ in_array($which, array('segment', 'rsegment'), TRUE) OR $which = 'segment';
+
+ if (isset($this->keyval[$which], $this->keyval[$which][$n]))
{
- return $this->keyval[$n];
+ return $this->keyval[$which][$n];
}
if ($which === 'segment')
@@ -502,7 +501,8 @@ class CI_URI {
}
// Cache the array for reuse
- $this->keyval[$n] = $retval;
+ isset($this->keyval[$which]) OR $this->keyval[$which] = array();
+ $this->keyval[$which][$n] = $retval;
return $retval;
}