DiDOM
DiDOM copied to clipboard
[PHP 8.2] Avoid Mbstring `HTML-ENTITIES` deprecation
In PHP 8.2, using the Base64, Uuencode, QPrint, and HTML Entity encodings are deprecated
There is one usage of the deprecated HTML-ENTITIES Mbstring encoder in \DiDom\Encoder::convertToHtmlEntities(), which relies on the buggy behavior of HTML-ENTITIES encoder, which does not encode characters that the htmlspecialchars function encodes.
This patch updates the direct HTML-ENTITIES encoding with three steps:
- Encodes the string to UTF-8 from the given encoding
$encoding - Encodes all HTML entities using
htmlentities - Decodes special chars (
<>'"&) usinghtmlspecialchars
Thank you.