CodeIgniter Forums

Full Version: Solution for URI issue anyone?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]JDG[/eluser]
I have just decided to make the change from ZF to CI but I have encountered my first problem. I have a fresh install and have tired to add my first controller and get the error message "The URI you submitted has disallowed characters."

I am using php 5.3 and searched around but wasn't able to find a solution. I guess my first question is, is there a solution? And the second is a request for guidance to solving this is possible.

Cheers,

JD

El Forum

[eluser]davidbehler[/eluser]
What does your URI look like?

El Forum

[eluser]JDG[/eluser]
This is what it looks like ...

http://example.com/index.php/products

nothing fancy really.

Cheers,

El Forum

[eluser]JDG[/eluser]
I found the solution. Minor change really all i did was the following.

In URI.php line 189:
Code:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))

replace with:
Code:
if ( ! preg_match("|^[".str_replace('\\-', '-', preg_quote($this->config->item('permitted_uri_chars')))."]+$|i", $str))

cheers

El Forum

[eluser]louis w[/eluser]
You shouldn't have to make any changes to URI.php. Out of the box CI works as expected.

I would suggest reverting back to the base install of CI and tracking down the actual problem.

Did you change the config value for permitted_uri_chars in your config?

El Forum

[eluser]Pascal Kriete[/eluser]
I'm afraid he has found the actual problem. In PHP 5.3 preg_quote was changed to escape the dash, so character ranges won't work. I can understand their reasoning even if I don't agree with changing behavior that has been around for roughly 7 (8?) years.

I haven't upgraded to 5.3 yet and I don't think anyone on the team has, but we'll get a fix into the SVN when that happens.

Thanks.

El Forum

[eluser]louis w[/eluser]
Wow, have to agree with you Pascal.

El Forum

[eluser]Bramme[/eluser]
After a format and installing a new Wampserver, I came across the same bug (found the solution on this blog)

I did the manual changes myself for now, but it would be nice if there was an update in the svn ^^

El Forum

[eluser]bluepicaso[/eluser]
Thank a lot it helped.