Welcome Guest, Not a member yet? Register   Sign In
URI.php error when passing parameter with : (colon)
#1

[eluser]Unknown[/eluser]
i got an error yesterday when passing parameter with : (colon)
http://kimci.detanto.net/hrd/member/999:2
i need to pass that value because i will use one function to display several list, in this case 999 is the identity of the member, 2 is the option. in my case 1 is "experience", 2 is "job description", and so on, so i need to pass the ":" string..
while researching, i find that on URI.php, there is additional procedure on _fetch_uri_string that is
Code:
if ($uri = $this->_detect_uri())
{
$this->uri_string = $uri;
return;
}
on _detect_uri() we can find
Code:
$uri = parse_url($uri, PHP_URL_PATH);
i have to change it to
Code:
$uri  = str_replace(":","~",$uri);
$uri = parse_url($uri, PHP_URL_PATH);
$uri  = str_replace("~",":",$uri);

At first, i create MY_URI because i don't want to change CI core, but it didn't work, because _detect_uri is a private function, so i have to change the CI core Sad .. is there any other way to fix it?
#2

[eluser]zivel[/eluser]
I have the same behavior. Is this a PHP Bug?
Because after some investigation I found out:

Code:
WORKS:
/object/:LOR:1
/object/LOR::1
/object/LOR:1:
/object/LOR:
/object/LO:RA3
and
Code:
DOES NOT WORK
/object/LOR:1
/object/LOR2:3
/object/LORA:3

any idea?
(here my testcode)
Code:
$url= array(
    "/object/:LOR:1"
    ,"/object/LOR::1"
    ,"/object/LOR:1:"
    ,"/object/LOR:"
    ,"/object/LO:RA3"
    ,"/object/LOR:1"
    ,"/object/LORA:3"
    ,"/object/LOR2:3");
foreach( $url as $v ){
  echo $v ." is: ";
  var_dump( parse_url( $v, PHP_URL_PATH ) );
}
#3

[eluser]InsiteFX[/eluser]
Try this.
Code:
$uri = parse_url($uri, urlencode(PHP_URL_PATH));

InsiteFX
#4

[eluser]zivel[/eluser]
Thats It! Thank you InsiteFX!

I changed now line 196 in /system/core/URI.php from
Code:
$uri =parse_url($uri, PHP_URL_PATH);
to
Code:
$uri = urldecode(parse_url(urlencode($uri), PHP_URL_PATH));

As a new member of this community, what should I do that this change is integrated into CodeIginter? Fill in a Bug report?

Thank you
- Renato




Theme © iAndrew 2016 - Forum software by © MyBB