note 117116 added to function.htmlspecialchars
| From: | Albert | Date: | Thu, 16 Apr 2015 14:30:17 +0000 |
| Subject: | note 117116 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202284@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 72.52.91.14
Probable Submitter: 93.108.136.36
----
Manual Page -- http://php.net/manual/en/function.htmlspecialchars.php
Edit -- https://master.php.net/note/edit/117116
Del: integrated -- https://master.php.net/note/delete/117116/integrated
Del: useless -- https://master.php.net/note/delete/117116/useless
Del: bad code -- https://master.php.net/note/delete/117116/bad+code
Del: spam -- https://master.php.net/note/delete/117116/spam
Del: non-english -- https://master.php.net/note/delete/117116/non-english
Del: in docs -- https://master.php.net/note/delete/117116/in+docs
Del: other reasons-- https://master.php.net/note/delete/117116
Reject -- https://master.php.net/note/reject/117116
Search -- https://master.php.net/manage/user-notes.php