PHP 4.0 Bug #7961 Updated: get_html_translation_table()

From: Date: Fri, 24 Nov 2000 16:19:59 +0000
Subject: PHP 4.0 Bug #7961 Updated: get_html_translation_table()
Groups: php.dev 
Request: Send a blank email to php-dev+get-39100@lists.php.net to get a copy of this message
ID: 7961 Updated by: waldschrott Reported By: jon@viventus.no Status: Closed Bug Type: Unknown/Other Function Assigned To: Comments: fixed in CVS Previous Comments: --------------------------------------------------------------------------- [2000-11-24 05:27:13] jon@viventus.no 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 '&#039;' as the value to the key '&'. When using the functions, '&' is translated to '&amp;'. This is especially bad since the Ascii code 039 represents the single quote ('), not the ampersand. Demonstrating code: <? echo "Special chars:nn"; print_r(get_html_translation_table(HTML_SPECIAL_CHARS)); echo "nnnEntities:nn"; print_r(get_html_translation_table(HTML_ENTITIES)); echo "nnnUsing htmlspecialchars():nn"; echo "[&] => " . htmlspecialchars('&'); echo "nnnUsing htmlentities():nn"; echo "[&] => " . htmlentities('&'); ?> --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7961

« previous php.dev (#39100) next »