Instead of this :
$this->segments = $val;
how about this :
$this->segments = urldecode($val);
In a certain case where the segments contained [ or ] characters the uri parsing was incorrect.
Can you give an example of when/how it fails?
Fix issues #388 & #705
(thanks to @sourcejedi, PR #1326 for pointing inconsistencies with RFC2616
Revert "fixes" for #167, #388, #705 (also #1326) as it turns out
URL-decoding isn't compliant with the CGI/1.1 specification.
RFC 3875: http://www.faqs.org/rfcs/rfc3875.html