From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.3.10 PHP Bug Type: Unknown/Other Function Bug description: get_html_translation_table() ambiguous
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 bug report at http://bugs.php.net/?id=33553&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33553&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33553&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33553&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33553&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33553&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33553&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33553&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33553&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33553&r=support Expected behavior: http://bugs.php.net/fix.php?id=33553&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33553&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33553&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33553&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33553&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33553&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33553&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33553&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33553&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33553&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33553&r=mysqlcfg