Hi Gajus,
Can you explain what you are needing to do with the “?” ? I ask, because there may be an ExpressionEngine way that will solve the issue for you. In the meantime, have you tried protecting the question mark with a “\” so:
$config['permitted_uri_chars'] = '\?a-z 0-9~%.:_\\-';
Cheers,
Doesn’t help. Leaving “permitted_uri_chars” empty didn’t help as well. Then I decided to look at the EE core, and this is what I’ve discovered:
if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
{
// preg_quote() in PHP 5.3 escapes -, so the str_replace() is to maintain backwards compatibility as
// many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
{
show_error('The URI you submitted has disallowed characters.', 400);
}
}
$str = str_replace(array("\r", "\r\n", "\n", ':',':','/','/'), array('', '', '', ':', ':', '/', '/'), $str);
if (preg_match("#(;|\?|{|}|<|>|http:\/\/|https:\/\/|\w+:/*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $str))
{
show_error('The URI you submitted has disallowed characters.', 400);
}
The error is triggered by the second conditional. Obviously, the latter doesn’t care about “permitted_uri_chars” settings. Furthermore, EE developers, please refer to filter_var($str, FILTER_VALIDATE_URL) rather than this REGEX mess. This however takes me to another error.
The following URL is Page module URL:
<a href="http://iiusa.anuary.com/en/membership-application/">http://iiusa.anuary.com/en/membership-application/</a>
The problem is, that appending literally anything to the end of the URL (e.g. ?get-variable or adding another URL segment) will cause 404. What are my options? It’s pretty stupid of EE developers not to strip out GET variables from URL when matching static page URL [..]