summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-02-13 04:38:39 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-02-13 04:38:39 +0100
commitb069789c78fdd1d33eff4b4f6c71a9883f1890a1 (patch)
tree80e5484d89d8de26598b2c47dfe0fc35a024e985 /system
parent881a79e0ce32bc579ff58449c85e183b96227615 (diff)
removed the array_diff comparison in _reindex_segments(). That conditional and use of those functions is probably slower than looping through both arrays, even if someone went crazy with dozens of URI segments.
Diffstat (limited to 'system')
-rw-r--r--system/libraries/URI.php23
1 files changed, 8 insertions, 15 deletions
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index 8de26f933..aecf05138 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -245,30 +245,23 @@ class CI_URI {
*/
function _reindex_segments()
{
- // Is the routed segment array different then the main segment array?
- // have to compute the diff both ways since PHP returns only values in $arr1 that are not in $arr2.
- $diff = (array_diff($this->rsegments, $this->segments) != array_diff($this->segments, $this->rsegments)) ? TRUE : FALSE;
-
$i = 1;
+
foreach ($this->segments as $val)
{
$this->segments[$i++] = $val;
}
+
unset($this->segments[0]);
- if ($diff == FALSE)
- {
- $this->rsegments = $this->segments;
- }
- else
+ $i = 1;
+
+ foreach ($this->rsegments as $val)
{
- $i = 1;
- foreach ($this->rsegments as $val)
- {
- $this->rsegments[$i++] = $val;
- }
- unset($this->rsegments[0]);
+ $this->rsegments[$i++] = $val;
}
+
+ unset($this->rsegments[0]);
}
// --------------------------------------------------------------------