• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.