ID: 33553 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open -Bug Type: Unknown/Other Function +Bug Type: Documentation problem Operating System: Linux PHP Version: 4.3.10 New Comment:
You surely mean slash here, and not ampersand? Anyway, this is not a PHP bug but a documentation issue. Previous Comments: ------------------------------------------------------------------------ [2005-07-03 17:09:54] [EMAIL PROTECTED] Description: ------------ get_html_translation_table() returns an array with two keys having value "'" (the ampersand). When array_flip()-ed, as suggested by the manual, the second one overwrites the first, thus giving a reverse table with only one ampersand key. Using this reverse table to convert back a string is not possible, since the original table had the other representation of the ampersand first, and used that for translation. See http://lxr.php.net/source/php-src/ext/standard/html.c#466 Note that if this is not deemed to be a PHP bug, then this irreversibility issue should be documented. Reproduce code: --------------- var_dump(htmlspecialchars("'", ENT_QUOTES)); var_dump(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)); var_dump(array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES))); Expected result: ---------------- No ambigous array elements in the translation table. Actual result: -------------- Two entries for the ampersand. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33553&edit=1