note 117113 deleted from function.htmlspecialchars by cmb
| From: | cmb@php.net | Date: | Sun, 27 Oct 2019 09:11:44 +0000 |
| Subject: | note 117113 deleted from function.htmlspecialchars by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212834@lists.php.net to get a copy of this message | ||
Note Submitter: Albert
----
I found a simple solution for the changed default character encoding in htmlspecialchars,
htmlentities and html_entity_decode, so my (very) old code kept running:
<?php
if (version_compare(phpversion(), "5.3.3", ">")) {
runkit_function_rename('htmlspecialchars', 'htmlspecialchars_new');
runkit_function_add(
'htmlspecialchars',
'$string, $flags, $encoding',
'return $encoding == "" ? htmlspecialchars_new($string, ENT_COMPAT | ENT_HTML401,
"ISO-8859-1") : htmlspecialchars_new($string, $flags, $encoding);'
);
runkit_function_rename('htmlentities', 'htmlentities_new');
runkit_function_add(
'htmlentities',
'$string, $flags, $encoding',
'return $encoding == "" ? htmlentities_new($string, ENT_COMPAT | ENT_HTML401,
"ISO-8859-1") : htmlentities_new($string, $flags, $encoding);'
);
runkit_function_rename('html_entity_decode', 'html_entity_decode_new');
runkit_function_add(
'html_entity_decode',
'$string, $flags, $encoding',
'return $encoding == "" ? html_entity_decode_new($string, ENT_COMPAT | ENT_HTML401,
"ISO-8859-1") : html_entity_decode_new($string, $flags, $encoding);'
);
}
?>