ID: 33553 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux PHP Version: 4.3.10 New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Special characters can be encoded in several ways. E.g. " can be encoded as ", " or ". get_html_translation_table() returns only the most common form for them." Previous Comments: ------------------------------------------------------------------------ [2005-07-03 17:24:49] [EMAIL PROTECTED] Sorry, I mean single quote, as it is evidenced by the lxr link I provided. ------------------------------------------------------------------------ [2005-07-03 17:15:31] [EMAIL PROTECTED] You surely mean slash here, and not ampersand? Anyway, this is not a PHP bug but a documentation issue. ------------------------------------------------------------------------ [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
