Getting the "Forbidden Key Characters" error in CodeIgniter

I am getting the following message: Forbidden key characters and the line generating the message seems to be

__utmt_~42

      

I'm just trying to load a page and for me life can't figure out why this is happening. It started out of nowhere. How can I find the source of this?

+3


source to share


4 answers


Had a similar problem, so for the sake of google search results:

__ utmt is a cookie. More specifically, the Google Analytics cookie. The "Number" part probably means a copy / duplicate of it. Think of it like the word.doc ~ 1 files that are stored on your computer when working in a Word document.

So first check the Google Analytics code on the website, is there a duplicate somewhere? My problem was solved by changing this duplicated line:

var pageTracker = _gat._getTracker("UA-1234567-89");
var pageTracker = _gat._getTracker("UA-1234567-89");

      



The weird thing is that the file always had this duplicate line of code as my GIT comes back. It could be a change in how the cookie code is handled by cookie ...

Oh, and the Forbidden Key Characters part. This is usually a good thing, protecting your CI application from harm.

Its in the file system \ core \ Input.php.

if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) {
    // there is no ~ in this regex pattern
    // You could add it, but you probably end up breaking other stuff ("/^[\w:~\/]+$/i")
    exit('Disallowed Key Characters');
}

      

+5


source


Follow the steps below



  • Find the _clean_input_keys function in /system/core/Input.php
  • update this output ("Forbidden Key Characters"); - exit ("Illegal key characters. $ str")
+6


source


Change system / core / Input.php

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


to 

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

      

+2


source


I was just going to comment, but apparently I don't have enough reputation. I had a similar problem this morning. This is caused by cookie (__utmt_ ~ 1). My site creates a cookie named __utmt, but not with a single underscore, tilde and 1. I suspect __utmt_ ~ 1 is a duplicate of the original cookie, but I'm not sure how it was created. However - clearing my cookies stopped the "Forbidden Key Characters" message.

+1


source







All Articles