Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated FILTER_SANITIZE_STRING usage. #2768

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions includes/Framework/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ public static function str_truncate( $string, $length, $omission = '...' ) {
* @return string
*/
public static function str_to_ascii( $string ) {
// strip ASCII chars 32 and under
$string = filter_var( $string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW );
// strip ASCII chars 127 and higher
return filter_var( $string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH );
// Strip ASCII chars 32 and under
$string = preg_replace( '/[\x00-\x1F]/', '', $string );
// Strip ASCII chars 127 and higher
return preg_replace( '/[\x7F-\xFF]/', '', $string );
}


Expand Down
Loading