File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -247,19 +247,14 @@ private static function _parseParams($key, $value)
247247
248248 }
249249
250- public static function _escape($string)
250+ public static function _escape($value): string
251251 {
252- //+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
253- $stripped = preg_replace('/\W/', '\\\\$0', $string);
254-
255- //Put the spaces back;
256- $stripped = str_replace('\ ', ' ', $stripped);
257- //Edge cases
258- $stripped = str_replace('\&\&', '\&&', $stripped);
259- $stripped = str_replace('\|\|', '\||', $stripped);
260-
261- return $stripped;
252+ $specialChars = ['"', '\\', '~', '^'];
253+ foreach ($specialChars as $char) {
254+ $value = str_replace($char, "\\".$char, $value);
255+ }
262256
257+ return $value;
263258 }
264259
265260 private function _buildQuery($wheres)
You can’t perform that action at this time.
0 commit comments