Welcome Guest, Not a member yet? Register   Sign In
Disallowed Key Characters that don't seem to be able to fix in config
#1

[eluser]shwonkbc[/eluser]
Hey CI,

I'm using Phorum, a messageboard, in conjunction with CI. Phorum, for some reason likes to use commas in their URIs when loading their CSS. Example:

http://MY-WEBSITE.com/messageboard/css.php?0,css

Unfortunately, this is greeted by CI with an emphatic "Disallowed Key Characters". I did some research and found you could fix that in config.php. I went in and changed:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=';
to
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=,'; (added a comma).

CI is still giving me the Disallowed Key Characters message. What can I do to fix this?

Thanks!
shwonk
#2

[eluser]jedd[/eluser]
Hi shwonkbc and welcome to the CI forums.

[quote author="shwonkbc" date="1260935498"]
http://MY-WEBSITE.com/messageboard/css.php?0,css
. . .
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=,'; (added a comma).
. . .
CI is still giving me the Disallowed Key Characters message. What can I do to fix this?
[/quote]

What happens if you add the question mark? Normally we don't like question marks, in CI-land .. not sure if that's what's giving you grief (should be allowed straight through). Just absent an error that says explicitly 'I don't like that , that's there' it'd be nice to rule it out.

I've had weirdness with trying to get the permitted_uri_chars to allow ( and ) characters .. but haven't investigated it properly yet. I suspect it's not an oft' used feature.
#3

[eluser]BrianDHall[/eluser]
I believe this is likely to be an encoding issue. There are multiple kinds of ', and there are also multiple kinds of "," most likely. I was running into this problem with -, as there are apparently at least two kinds of those as well. Quite annoying.

I solved it by finding a link that was broken, directly selecting the offending character in the url and choosing Copy, then Paste into my UTF-8 compatible file editor, and that worked.
#4

[eluser]shwonkbc[/eluser]
Okay, so I've tried adding a ? to $config['permitted_uri_chars'], and I tried directly copy pasting the comma in, and neither is working.

I've simplified it to 'www.MY-SITE.com?,' will throw the Disallowed Key Characters error. Thanks for those who've tried. Anyone else have any ideas? Is there a special way to include a comma?

Note:
$config['permitted_uri_chars'] is currently 'a-z 0-9~%.:_,?\-=';
#5

[eluser]jedd[/eluser]
Oh .. have you changed this (in config.php)
Code:
$config['enable_query_strings'] = FALSE;

to this
Code:
$config['enable_query_strings'] = TRUE;

The reason I say we don't like question marks is because we tend to not use query strings. Read the [url="/user_guide/general/urls.html"]URL information[/url] in the user guide for some more insight.
#6

[eluser]shwonkbc[/eluser]
Already done it, unfortunately.
#7

[eluser]jedd[/eluser]
Is your original URL - with ? and , - parsed by CI (if not accepted once it arrives) okay once you remove the comma? As in, are we sure that it's the comma that it's complaining about?

What if you do the 0x... whatever you need for a comma .. in place of the literal comma? Oh, and after this I'm going to be precisely as clueless about the problem as I first appeared to be. Insert pre-emptive apology here.
#8

[eluser]shwonkbc[/eluser]
Okay, I fixed it, but I had to do a little hacking. I searched for strings matching "Disallowed Key Characters" in CI. Turns out that in "system/libraries/Input.php" there's this private function:

function _clean_input_keys($str)
{
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
exit('Disallowed Key Characters.');
}

return $str;
}

I changed the preg_match by adding a "," in front of the 'a'. It seems there's no way to fix this without hacking. CI should try to fix that. Thanks jedd and BrianDHall for trying to help. I really appreciate it.
#9

[eluser]BrianDHall[/eluser]
If you feel so inclined you might want to report this as a bug, I don't see how this could be intended behavior.
#10

[eluser]darkhouse[/eluser]
I ran into a similar issue where I have the @ in my url (which is necessary due to where the url is being generated) but I also need to accept a query string for some other stuff, and the @ breaks the query string. I ended up extending the input class, duplicating that function and commenting out that preg_match - I couldn't see any other work around (adding the @ into the preg_match didn't work. But if anyone has a proper solution instead of my "comment it out" solution, I'd rather do that.




Theme © iAndrew 2016 - Forum software by © MyBB