Update Secury.php

Add remove control characters \x7F and \xC2\x80- \xC2\x9F
This commit is contained in:
Visman 2020-10-27 13:31:10 +07:00
parent 252c6dfe96
commit 2a6e260d30

View file

@ -83,7 +83,7 @@ class Secury
if (\is_array($data)) {
return \array_map([$this, 'replInvalidChars'], $data);
} elseif (\is_int($data)) {
return (int) $data;
return $data;
}
// Replacing invalid UTF-8 characters
// slow, small memory
@ -93,6 +93,6 @@ class Secury
// Canonical Decomposition followed by Canonical Composition
$data = Normalizer::normalize($data, Normalizer::FORM_C);
// Remove control characters
return \preg_replace('%[\x00-\x08\x0B-\x0C\x0E-\x1F]%', '', $data);
return \preg_replace('%(?:[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|\xC2[\x80-\x9F])%', '', $data);
}
}