EllisLab/CodeIgniter — Issue #779: URI string format inconsistency
Author: janogarcia
Created: 2011-12-13 19:20:13+00:00
State: open

Tested in CodeIgniter 2.1.0.

According to the issue #9 the $uri_string property of the URI class **should never contain a leading forward slash**:
https://github.com/EllisLab/CodeIgniter/issues/9#issuecomment-1888923

However this does **depend on the detection method used** by $this->uri->_fetch_uri_string()

For example: **_detect_uri() trims the leading slash**, while **the $_SERVER['PATH_INFO'] based method preserves it**.

The temporary fix I made removes always any leading or trailing forward slash from $this->uri->uri_string, as that is the intended behavior since the CodeIgniter Reactor era.

$path should be always trimmed trim($path, '/') before calling $this->_set_uri_string($path), as $this->_detect_uri() does.