[eluser]Michael Ekoka[/eluser]
hey Kumar,
at line 408 of the Router.php file, the different segments of your url are matched against the permitted uri characters entered in the config file.
That little routine uses a combination of the preg_match() and preg_quote() functions. preg_quote is supposed to escape the special regular expression characters like \ : . | etc, prior to sending them to preg_match. Now, my guess is that when you tried to add your single quote to the list of permitted characters in the config file, you simply appended it to the list, resulting in something like this:
The problem with this is that the dash (-) is not part of the list of special characters escapable by preg_quote().
So the resulting escaped string submitted to preg_match will look like this:
Now, notice that after the preg_quote operation, this entire string will be surrounded by brackets inside preg_match:
Code:
preg_match("|^[a-z 0-9~%\.\:_-']+$|i", $str))
The result is that the dash will not be evaluated as a character, but rather as if marking a range. Therefore, preg_match will try to match all characters in the
range between a and z [a-z], 0 and 9 [0-9] AND FINALLY between the underscore and the single quote [_-'], this latter attempt is what's causing the error.
To fix, you need to add characters before the dash in your config file:
Or if you choose to hack your CI installation a little bit:
- modify the permitted char entry in the config to manually escape the dash:
Code:
$config['permitted_uri_chars'] = '\-'.preg_quote('a-z 0-9~%.:_+=');
- then in the Router.php file replace the current snippet of code at line 408:
Code:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
by this one which removes the preg_quote:
Code:
if ( ! preg_match("|^[".$this->config->item('permitted_uri_chars')."]+$|i", $str))
If you choose the latter path, make sure to document your changes, in your Router.php file and your config file. But, personally I would modify the core files only if I have no other option. So I would rather recommend the first solution.
Good luck.