Welcome Guest, Not a member yet? Register   Sign In
CI2 Disallowed Key Characters in JSON
#1

In system\core\Input.php.
if( ! preg_match('/^[~a-zA-Z0-9{},:_\/-]+$/i', $str))
{
    exit('Disallowed Key Characters: '.$str);
}
This piece of code triggers Disallowed Key Characters when $str contains:
{"education_level":"1","job_experience":"1","occupation":"41-3011","onet_code"
:"41-3011_00","region":"22220","relevance":"0","school":"0","schoolstate":"0","state":"4","gpa":"0","major"
:"0"}
Reply
#2

See the PHP Manual json_decode() and json_encode()
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 03-23-2018, 08:24 AM by ciadmin. Edit Reason: SEO spam redacted )

You can use this code to disallowed key character in JASON

Find the function _clean_input_keys($str)

Change:

exit('Disallowed Key Characters.');

to:

 exit('Disallowed Key Characters.'. $str);


<input type="text" name="myarray['data1']" \>

And I just changed the input's name.

<input type="text" name="myarray[data1]" \>

Reply




Theme © iAndrew 2016 - Forum software by © MyBB