Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix issue #779

  • Loading branch information...
commit f5f898f8f30968fb36413a14de2dc6a4599b79a6 1 parent 348bd1e
@narfbg narfbg authored
View
7 system/core/URI.php
@@ -165,11 +165,8 @@ public function _fetch_uri_string()
*/
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), '/');
}
// --------------------------------------------------------------------
View
12 tests/codeigniter/core/URI_test.php
@@ -40,13 +40,13 @@ public function test_fetch_uri_string()
'/index.php?/controller/method/?var=foo' => 'controller/method'
);
- foreach($requests as $request => $expected)
+ foreach ($requests as $request => $expected)
{
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['REQUEST_URI'] = $request;
$this->uri->_fetch_uri_string();
- $this->assertEquals($expected, $this->uri->uri_string );
+ $this->assertEquals($expected, $this->uri->uri_string);
}
// Test a subfolder
@@ -60,10 +60,10 @@ public function test_fetch_uri_string()
unset($_SERVER['REQUEST_URI']);
// life to path info
- $_SERVER['PATH_INFO'] = $a = '/controller/method/';
+ $_SERVER['PATH_INFO'] = '/controller/method/';
$this->uri->_fetch_uri_string();
- $this->assertEquals($a, $this->uri->uri_string);
+ $this->assertEquals('controller/method', $this->uri->uri_string);
// death to path info
// At this point your server must be seriously drunk
@@ -72,7 +72,7 @@ public function test_fetch_uri_string()
$_SERVER['QUERY_STRING'] = '/controller/method/';
$this->uri->_fetch_uri_string();
- $this->assertEquals($a, $this->uri->uri_string);
+ $this->assertEquals('controller/method', $this->uri->uri_string);
// At this point your server is a labotomy victim
unset($_SERVER['QUERY_STRING']);
@@ -80,7 +80,7 @@ public function test_fetch_uri_string()
$_GET['/controller/method/'] = '';
$this->uri->_fetch_uri_string();
- $this->assertEquals($a, $this->uri->uri_string);
+ $this->assertEquals('controller/method', $this->uri->uri_string);
// Test coverage implies that these will work
// uri_protocol: REQUEST_URI
View
1  user_guide_src/source/changelog.rst
@@ -372,6 +372,7 @@ Bug fixes for 3.0
- Fixed a bug where :doc:`Email Library <libraries/email>` didn't honor it's *wordwrap* setting while handling alternative messages.
- Fixed a bug (#1476, #1909) - :doc:`Pagination Library <libraries/pagination>` didn't take into account actual routing when determining the current page.
- Fixed a bug (#1766) - :doc:`Query Builder <database/query_builder>` didn't always take into account the *dbprefix* setting.
+- Fixed a bug (#779) - :doc:`URI Class <libraries/uri>` didn't always trim slashes from the *uri_string* as shown in the documentation.
Version 2.1.3
=============
Please sign in to comment.
Something went wrong with that request. Please try again.