b2f1638c by Chris Boden

Returning false if there is a json error in user search

1 parent cf04a618
...@@ -179,7 +179,11 @@ class UserSearch implements ArrayAccess, Iterator, Countable { ...@@ -179,7 +179,11 @@ class UserSearch implements ArrayAccess, Iterator, Countable {
179 } 179 }
180 180
181 list($user_id, $user_string) = mysql_fetch_row($this->result); 181 list($user_id, $user_string) = mysql_fetch_row($this->result);
182 $data = array_merge(array_map(function() { return ''; }, array_flip($this->fields)), json_decode($user_string, true)); 182 $json_data = json_decode($user_string, true);
183 if (json_last_error() != JSON_ERROR_NONE) {
184 return false;
185 }
186 $data = array_merge(array_map(function() { return ''; }, array_flip($this->fields)), $json_data);
183 foreach ($data as $key => &$val) { 187 foreach ($data as $key => &$val) {
184 $val = maybe_unserialize($val); 188 $val = maybe_unserialize($val);
185 } 189 }
......