0

I am trying to passing a value, something like 2:03, in codeigniter controller function. But it is not working. If I send any int or char or something like '2:03:56:45' it works.

Can someone tell me please what is going wrong with '2:03'?

My code is here :

function get_value($point_code ){

    echo $point_code;die(); 

}

here $point_code is 2:03

9
  • why are you using die and not return? Is this an ajax call or something? Commented Oct 16, 2013 at 19:59
  • Are you passing 2:03 or '2:03'? If there is a colon in it, it needs to be a string (in quotes). Commented Oct 16, 2013 at 20:01
  • Define "not working". Do you see the wrong data echoed? No data? An error? What does it do that makes you think it's "not working"? Commented Oct 16, 2013 at 20:03
  • i am passing 2:03 . no it is not a ajax call. not working means no data printed and no error showing. Commented Oct 16, 2013 at 20:10
  • 1
    Please show the code where you call the function. Commented Oct 16, 2013 at 20:13

1 Answer 1

1

It appears there is an issue in CodeIgniter when the URI has a single colon followed by a number.

See:

The solution given in the forums is to modify system/core/URI.php and change

$uri = parse_url($uri, PHP_URL_PATH);

To:

$uri = urldecode(parse_url(urlencode($uri), PHP_URL_PATH));

This is line 219 in the 2.1.4 release of CI.

I was able to reproduce the issue and updating that line resolved the issue for me.

I really hate solutions that involve modifying the core files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.