Permalink
Browse files

Fix #1811

  • Loading branch information...
1 parent 04c50f5 commit 4a7cc768a836a12c4839e482715b3859e0c16d7d @narfbg narfbg committed Oct 24, 2012
Showing with 9 additions and 6 deletions.
  1. +8 −6 system/core/URI.php
  2. +1 −0 user_guide_src/source/changelog.rst
View
@@ -433,9 +433,9 @@ public function ruri_to_assoc($n = 3, $default = array())
/**
* 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')
@@ -445,9 +445,11 @@ protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
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')
@@ -499,7 +501,7 @@ protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
}
// Cache the array for reuse
- $this->keyval[$n] = $retval;
+ $this->keyval[$which][$n] = $retval;
return $retval;
}
@@ -380,6 +380,7 @@ Bug fixes for 3.0
- Fixed a bug (#191) - :doc:`Loader Library <libraries/loader>` ignored attempts for (re)loading databases to ``get_instance()->db`` even when the old database connection is dead.
- Fixed a bug (#1255) - :doc:`User Agent Library <libraries/user_agent>` method ``is_referral()`` only checked if ``$_SERVER['HTTP_REFERER']`` exists.
- Fixed a bug (#1146) - :doc:`Download Helper <helpers/download_helper>` function ``force_download()`` incorrectly sent *Cache-Control* directives *pre-check* and *post-check* to Internet Explorer.
+- Fixed a bug (#1811) - :doc:`URI Library <libraries/uri>` didn't properly cache segments for ``uri_to_assoc()`` and ``ruri_to_assoc()``.
Version 2.1.3
=============

0 comments on commit 4a7cc76

Please sign in to comment.