Core/URI.php: Parse_url() fails if a segment contains "foo:digit"
== Details == Type: Function stops script File: core/URI.php:176
== Description == Parse_url will fail on URIs with segments that look like "foo:number". It is the colon that appears to be causing it (probably because parse_url thinks that it is a port number, and thus malformed).
== Replication == Go to a URL like this: http://localhost/ci/foo/bar/test:2/
== Proposed fix == Substitute ":" with a tag, parse the URI, and then reinstate the ":" again.
== Original code == {{{
!php
$uri = parse_url($uri, PHP_URL_PATH); }}}
== Workaround == {{{
!php
if (preg_match('/:\d/', $uri)) { $uri = str_replace('{C0L0N}',':',parse_url(str_replace(':','{C0L0N}',$uri),PHP_URL_PATH)); } else $uri = parse_url($uri, PHP_URL_PATH); }}}
http://www.php.net/manual/en/function.parse-url.php
Note: This function doesn't work with relative URLs.
The usage of parse_url() in CI is wrong.
Wouldn't this fix replace a segment thar contains the exact text {COLON} with :?
As PHP_URL_PATH is used, the simplest solution is to just prepend a dummy scheme and hostname to $uri.