URI->_remove_url_suffix() : more efficient code
related to #2135
diff --git a/system/core/URI.php b/system/core/URI.php
index 8d0d8fd..9b31a64 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -358,11 +358,11 @@
return;
}
- $offset = strrpos($this->uri_string, $suffix);
+ $slen = strlen($suffix);
- if ($offset !== FALSE && $offset === strlen($this->uri_string) - strlen($suffix))
+ if (substr($this->uri_string, -$slen) === $suffix)
{
- $this->uri_string = substr($this->uri_string, 0, $offset);
+ $this->uri_string = substr($this->uri_string, 0, -$slen);
}
}