PHP 4.0 Bug #7961: get_html_translation_table()
| From: | jon at viventus dot no | Date: | Fri, 24 Nov 2000 10:27:13 +0000 |
| Subject: | PHP 4.0 Bug #7961: get_html_translation_table() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39090@lists.php.net to get a copy of this message | ||
From: jon@viventus.no
Operating system: Linux RedHat 6.2
PHP version: 4.0.3pl1
PHP Bug Type: Unknown/Other Function
Bug description: get_html_translation_table()
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('&');
?>
--
Edit Bug report at: http://bugs.php.net/?id=7961&edit=1