|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-11-24 11:19 UTC] waldschrott@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 02 14:00:01 2026 UTC |
get_html_translation_table() is supposed to return an array representing the translation table used in htmlspecialchars() and htmlentities(). It doesn't. There is at least one inconsistency between the supposed translation table and the real translation performed by the two functions: The translation table gives ''' as the value to the key '&'. When using the functions, '&' is translated to '&'. This is especially bad since the Ascii code 039 represents the single quote ('), not the ampersand. Demonstrating code: <? echo "Special chars:\n\n"; print_r(get_html_translation_table(HTML_SPECIAL_CHARS)); echo "\n\n\nEntities:\n\n"; print_r(get_html_translation_table(HTML_ENTITIES)); echo "\n\n\nUsing htmlspecialchars():\n\n"; echo "[&] => " . htmlspecialchars('&'); echo "\n\n\nUsing htmlentities():\n\n"; echo "[&] => " . htmlentities('&'); ?>