parse_str randomly adding semicolons to keys parse_str randomly adding semicolons to keys codeigniter codeigniter

parse_str randomly adding semicolons to keys


This is caused by the config variable global_xss_filtering in Codeigniter. Set it to false to disable this behaviour.

See also:
xss_clean adds semicolon to anything with an &
CodeIgniter adding semicolons


I would first do a var_dump of the $filters to see what is coming in.

parse_str will parse the string you send it like so:

$string = "user=&companies=StackOverflow";parse_str($string, $filters);echo $filters['user']; // empty stringecho $filters['companies']; // StackOverflow

My best guess is that what is being sent from iQuery's serialize (inclusive of the data) is not properly serialized/escaped probably so parse_str can easily split the string with the & as the separator for key/value of each parameter.

Reading the manuals you are definitely doing things correctly there but there might be something lurking in your data that throws the parse_str off. I would also look for illegal characters in the sting posted by jQuery.