Rust

sanitize

Module

The sanitizing filters of ext/filter/sanitizing_filters.c (PHP 8.5), with the parts of ext/standard they call: php_strip_tags_ex() (string.c), php_escape_html_entities_ex() (html.c, as FILTER_SANITIZE_FULL_SPECIAL_CHARS calls it: every HTML 4.01 entity, UTF-8, no double encoding) and php_addslashes().

Every function takes the value already converted to a string and returns the filtered value; none of them can fail.