note 117116 deleted from function.htmlspecialchars by cmb

From: Date: Sun, 27 Oct 2019 09:18:34 +0000
Subject: note 117116 deleted from function.htmlspecialchars by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212853@lists.php.net to get a copy of this message
Note Submitter: Albert ---- The code I posted this morning (for giving back to htmlspecialchars etc. the old default ISO encoding) had some strange problem, didn't work if a page was reloaded! Here the code I came up with, without this problem: <?php if (version_compare(phpversion(), "5.3.3", ">")) { runkit_function_copy('htmlspecialchars', 'htmlspecialchars_new'); runkit_function_redefine( 'htmlspecialchars', '$string, $flags, $encoding', 'return $encoding == "" ? htmlspecialchars_new($string, ENT_COMPAT | ENT_HTML401, "ISO-8859-1") : htmlspecialchars_new($string, $flags, $encoding);' ); runkit_function_copy('htmlentities', 'htmlentities_new'); runkit_function_redefine( 'htmlentities', '$string, $flags, $encoding', 'return $encoding == "" ? htmlentities_new($string, ENT_COMPAT | ENT_HTML401, "ISO-8859-1") : htmlentities_new($string, $flags, $encoding);' ); runkit_function_copy('html_entity_decode', 'html_entity_decode_new'); runkit_function_redefine( '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);' ); } ?> So first I copy the original function, then I redefine the same.

« previous php.notes (#212853) next »