Skip to content

Commit

Permalink
Fix deprecated use of filter constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
tchalvak committed Jan 30, 2023
1 parent 1e72e24 commit 90e3c6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions deploy/lib/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ public static function toInt($dirty) {
// Cast anything that can be non-destructively cast.
}

public static function filter_string_polyfill(string $string): string {
$str = preg_replace('/\x00|<[^>]*>?/', '', $string);
return str_replace(["'", '"'], ['&#39;', '&#34;'], $str);
}

/**
* Strip low and high ascii characters, leave standard keyboard characters
*/
public static function toSimple($dirty) {
return filter_var(
return static::filter_string_polyfill(filter_var(
str_replace(['"', '\''], '', $dirty),
FILTER_SANITIZE_STRING,
FILTER_SANITIZE_FULL_SPECIAL_CHARS,
FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH
);
));
}
}

0 comments on commit 90e3c6f

Please sign in to comment.