TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Disallowed key characters in global data
  • Hi there, I've traced this error down to the input library filtering its input by doing a search on the source code.

    I thought the way round it would be to reference $_POST directly, but strangely I still get the error! There's way too much code to post, an Kohana isn't giving me any clues.

    Any idea what's happening!?

    Thanks, Dave

  • OK - I'm now thinking this is actually something to do with Kohana::config, as one of my config files has an array with keys that look like this:

    'some/key' => 'some value'

    I'm actually storing paths in keys. Is this not allowed? What alternatives should I look at? Can I turn off this filtering?

    Cheers, Dave

  • Make a Input extension and overload the clean_input_keys method. See line 398 for the (very short) standard method. Generally, you should store file paths as values, not as key names. Obviously, Kohana breaks this rule with routes....

  • Great solution, thanks so much Shadowhand.

  • I've had this a couple of times recently too.

    Couldn't kohana offer a little more information in the error message?

    this feels less like a feature and more like a bug to me?
  • i just got this error when upgrading from 2.2.1 to 2.3.
    I compared the clean_input_keys method from both and they are the same!
    I tried getting rid of my routes config file but that had no effect.
    Does anyone know offhand anything relevant that changed between those two versions? I'm hoping not to have to step through the whole bootstrap process....
  • Maybe you should actually read this thread, at least you would know where to look in the source.

  • @Shadowhand:
    First off, let me say that I think your coding is really good:you write really tight, efficient, clever code, and I for one appreciate all the hard work you've put into Kohana.

    However I fail to understand why you have to be Oscar the Grouch all the time, and why you are so universally unpleasant to people who are asking a simple question.

    If you had actually read my response, you would know that I did look in the source, specifically line 398 of the input class as you suggested. There is no difference between that class method and the one in version 2.2.1, yet my app broke with the error message that titles this thread as soon as i changed my index.php to point to 2.3 system files, that being the only change i made. So obviously line 398 of the input class has nothing to do with anything.

    You may very well be Gods Gift to Programmers, which is the attitude you typically take on this forum, but even if so, that means you are in a position of great power, and with great power comes great responsibility, in this case, the responsibility to help people who are not as fully versed as you in Kohana's mysteries. Instead, you tend to abuse your position as "benevolent(?) dictator-for-life" to act like a dick to people who just are seeking knowledge.

    If I put myself in your position, then yes, I too would probably have a short fuse when it came to what I perceived (as you have often mentioned in various threads) people who "want you to write their app for them". But that doesn't mean that everybody who asks what you think is a stupid question is trying to do that, and it's certainly no excuse for being rude.

    Have I ever said anything to offend you? With the exception of perhaps particular parts of this post, I think not. So why so rude?

    If your forum posts were as helpful as the code you write is good, you could be a true Programming God, and people would practically worship you. When you are nasty to people for no reason, it just makes you seem like a jerk.

    Once again, let me reiterate that I think you are a very talented programmer. It's a shame you aren't as good at being a person -- at least on this forum. In real life you may be really cool for all i know, and I certainly hope that is true, otherwise it's just very sad. I wish you luck in dealing with your anger/misanthropy issues.
  • If I come off as being grouchy, it is only because every day I wake up, come to these forums, and get nothing but frustrated by people constantly not trying to debug, or fix, things themselves. The Kohana source code is easy to read and our errors give you traces with lines numbers... I just do not understand why no one takes the time to drop a debug statement at the line when they have errors!

    I am sure that most of you are perfectly enjoyable people in the real world, but understand that all I ever see from my perspective is "why does X not work like I think it should?!" It is a source of never-ending source of "nothing is good enough" feelings for me to read these forums day after day. I mean absolutely nothing personal by any response I make; just try to put yourself in my shoes and maybe you can understand why I can be very curt. In the end, both you and I are taking the interactions we have here much more personally than we should.

  • Thank you, I very much appreciate your candor, and I truly apologize if anything i said was hurtful, I have to admit I was speaking out of some irritation, as I always DO try to debug/fix stuff myself -- usually for several hours -- before throwing myself on the mercy of the forum!

    I cannot help it if my programming skills are not up to the level of those of the (truly impressive) Kohana devs, and it occurs to me that perhaps it is a simple matter of perspective -- when you are close to programming Godhood, maybe things seem simple that to us worker bees are still obscure.

    putting myself in your shoes I can certainly understand your feelings, and please understand I have nothing but the highest respect and admiration for all the work you put in daily to make this a great framework, which i believe it is. I did 3 months of research into MVC's before coming to the ineluctable conclusion that Kohana is far superior to all of the dozens of others I looked at, and you should feel great pride in your accomplishment.

    Perhaps it could help you if, instead of 'nothing is ever good enough', you took from people's comments the feeling of 'i can't understand the level of sophistication of your code - can you help me?', which, I'd be willing to bet, is the case in 99% of people's questions, and whatever irritation they convey in their posts is probably due to their frustration in not 'getting it'.

    Another humble suggestion - perhaps you are taking on too much yourself? maybe give questions a few hours to stew, let somebody else give them a whack, before you feel obligated to step in? That way you could feel less overwhelmed.

    Anyway, i agree with you that we are both taking things too personally, and I will do what I can to avoid that in future.

    In the meantime, this particular error comes not as a typically helpful Kohana error message with traces, but by itself as the only content of the returned page. I continue to step through, but have not found where it has objection to the the 'key characters' -- it blows up in the clean_input_keys method of the input class after failing the preg_match check, but I can't figure out why. When i switch the system directory in index.php back to the 2.2.1 version it works fine, and comparing both that method and the definition of PCRE_UNICODE_PROPERTIES in uft8 between the 2.2.1 and the 2.3 versions, they are identical, and as such I don't even know where to place a breakpoint to figure out what is going on.

    Once again, please let me make my appreciation of your efforts clear, and I hope you will accept my apology for speaking disrespectfully, as I hold your skills in the highest esteem.
    FWIW, I've discovered that the cause of the issue is that 2.3 version doesn't seem to like segments with trailing slashes (a flaw in my code regarding how I am creating the segment, which I have now fixed, so my bad as usual, not yours), while 2.2.1 didn't seem to care. I have not yet found where that difference arises.
    Strangely, when I remove the trailing slash, the 2.3 version takes me to my default route instead of the desired segment/class....
    Still stepping through....
  • Got same problem as RastaTech, tried to remove check in clean_input_keys that does no good. When i removed check only default route is viewable no matter what link you use. Any solutions?
  • I just ran into this problem as well. After some debugging it looks like when intense debate (comment system I use) posts a comment, it sets a cookie to that data. Well mine contained "There's plenty..." (note the ' which was a no-no).

    I fixed it myself by just deleting the cookie but how can I prevent this in the future? Just override the input class and don't have it check cookie data?

    to elaborate on this. I know I can do the MY_Input.php thing to override the class, but then does that mean I have to rewrite the entire __constructor class since that's where the issue is? I guess I'm looking for a way to fix this but not really mess with the security benefits of cleaning text to begin with.
  • I had this error come up after a clean install. All I was trying to do is print 'Hello World'. Nothing Input (form, $_POST) related. Nothing but the URI. I re-looked at my .htaccess file I setup and made some changes and the problem went away. Don't know if this will help someone?
  • sorry, double post
  • I had this problem 5 minutes ago, but i got it working.

    I'm currently using Kohana 2.3.2.

    i was using form helper and left it on default for testing:

    echo form::upload($attributes, 'path/to/local/file');

    turns out it was the 'path/to/local/file' that was making it not work, because I was getting:

    i replaced it with:

    and it's working fine now.
  • i got he same thing and it was puzzling me for a while

    turned out a i had a ?> tag and it had 2 closing ?> endtags.
    i guess ? is not allowed

    if your problem is happening intermittently, i am guessing the name="tag" of one of your form elements has some unfriendly chars
    that are being set dynamically
  • It is much easier to locate the source of the problem, if you append the input string to the exit message:

    exit('Disallowed key characters in global data: '.$str);

    Since this exit follows any violation of input regex, many types of problem may be.
  • just ran into this myself. Not sure how any of these fixes really fix my issue. I did

    exit('Disallowed key characters in global data: '.$str);

    that showed me the key that caused the problem so I added kohana::debug($GLOBALS) to the string, and found this problem does occure in the in $_COOKIE and HTTP_COOKIE_VARS arrays.

    [HTTP_COOKIE_VARS] => Array
    [__utma] => 40853754.594559895.1257611307.1258210799.1258217809.12
    [__utmz] => 40853754.1257611307.1.1.utmcsr=infonet|utmccn=(referral)|utmcmd=referral|utmcct=/homeheader.asp
    [__utmc] => 40853754
    [s_cc] => true
    [s_sq] => tsgintranet=%26pid%3Dhttp%253A//www.twcable.com/%26oid%3Djavascript%253A__doPostBack%2528%2527dnn%2524ctr29769%2524Links%2524cmdGo%2527%252C%2527%2527%2529%26ot%3DA%26oi%3D618
    [PRVPPSFSWEB05-80-PORTAL-PSJSESSIONID] => WSvJK22Nv262fbtQg5LK96QsChYwT6BS!1572422585
    [ExpirePage] =>
    [http://www05_twcable_com/psp/fiprd/employee/erp/refresh] => list:|?tab=default
    [PS_TOKENEXPIRE] => -1
    [PS_TOKEN] =>
    [SignOnDefault] => E106325

    If I clear the cookies the problem still exists. but if I close and reopen the browser it goes away until this person again goes to the apparent offending site http://www05_twcable_com/psp/fiprd/employee/erp/refresh (which is not related at all to this Kohana instance.)

    My question is why is kohana loading this cookie data, and how can I stop it from loading this cookie, and another one I saw from 401k.com that caused the error.
  • The answer to the question 'how can I fix this' is already on this thread:

    Posted By: Shadowhand

    Make a Input extension and overload the clean_input_keys method. See line 398 for the (very short) standard method. Generally, you should store file paths as values, not as key names. Obviously, Kohana breaks this rule with routes....

    The cookie name that is causing the problem is http://www05_twcable_com/psp/fiprd/employee/erp/refresh - the colon (:) character is not allowed in a cookie name per RFC 2965. Fix the software that is setting this cookie and you won't have a problem.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion