11

I have a code igniter project, and I wanted to try debugging it using Zend Studio. WHen I start debugging, I immediately run ino

"The URI you submitted has disallowed characters."

Does anyone have any idea?

Charles
  • 50,943
  • 13
  • 104
  • 142
  • Out of curiosity, does anyone know whether the permitted characters matches the URI specification? Obviously, the rejection of "?" means they are not, but what about others. This seems to be another example of a system that fails to properly implement the basics (RFC-based functionality). – Rob Williams Dec 08 '08 at 06:12
  • I checked, and PHP is NOT compliant with the URL/URI specification. – Rob Williams Dec 17 '08 at 01:22
  • 2
    We updated our Server to PHP 5.3 and run into this problem several times because of old Codeigniter Installations. You could try this link: http://riskianawulan.net/2010/11/fixed-the-uri-you-submitted-has-disallowed-characters-error-codeigniter/ – felix Apr 16 '12 at 19:24

3 Answers3

26

(Assuming you are using the latest version of CodeIgniter (CI) which is 1.7.0)

CI is pretty strict about what characters it allows in URLs. You can modify the regex that is used to filter URLs.

In system/config/config.php on line 126 is

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

The comment above this line pretty much explains it all, and what sentinel value to use to over-ride this filter and permit all characters (i.e. turn off filtering completely).

On a side note, I found CI to be way too restrictive (for one it doesnt allow for GET requests and wants all interactions to happen via POST. I find this absolutely crazy and is akin to throwing the baby out with the bath water. Apparently, I am not the only one who thinks that CI is overly restrictive, the Kohana Project is a fork of CI + optimizations, namely pure php5 support (all OO), (CI is still PHP4 compatible at the expense of not being able to take advantage of PHP5 OO capabilities).

I prefer Kohana over CI, YMMV

http://kohanaphp.com/home

Cody Caughlan
  • 32,456
  • 5
  • 63
  • 68
  • Some characters you can't add to the exclusion list. Try as you might, you cannot exclude the # char. You will have to strip that out before sending via http. – TARKUS Feb 18 '14 at 23:14
7

If using an old version of CodeIgniter and PHP 5.4 you have to modify

if ( ! preg_match("|^[" . preg_quote($this->config->item('permitted_uri_chars')) . "]+$|i", $str)) {

into

if (FALSE === preg_match("|^[" . preg_quote($this->config->item('permitted_uri_chars')) . "]+$|i", $str)) {

in /system/libraries/URI.php

Stelian
  • 668
  • 10
  • 18
2

in Expression engine you'll find this in /admin/expressionengine/config/config.php

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\\-';

change to

$config['permitted_uri_chars'] = ''; 

but read the line comment before you do this.

Or don't use anything CI based.

Andreas
  • 384
  • 1
  • 3
  • 9