From: spam2 at rhsoft dot net Operating system: Linux PHP version: 5.4.10 Package: Scripting Engine problem Bug Type: Bug Bug description:htmlentities fundamentally broken in 5.4
Description: ------------ > Like htmlspecialchars(), htmlentities() takes an optional third > argument encoding which defines encoding used in conversion. If > omitted, the default value for this argument is ISO-8859-1 in > versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards and you broke randomly applications with this without specifiy 'ISO-8859-1' we get randomly EMPTY STRINGS back [harry@rh:/downloads/htmlentities]$ ./test.php -------------------------------------------------------------------- strlen($input): 4464 -------------------------------------------------------------------- strlen(htmlentities($input, ENT_QUOTES)): 0 -------------------------------------------------------------------- strlen(htmlentities($input, ENT_QUOTES, 'ISO-8859-1')): 6522 Test script: --------------- #!/usr/bin/php <?php $input = base64_decode(file_get_contents(__DIR__ . '/70acc70b9c93b6a677825241e8165562_base64.txt')); echo '--------------------------------------------------------------------' . "\n"; echo 'strlen($input):' . "\n"; echo strlen($input) . "\n"; echo '--------------------------------------------------------------------' . "\n"; echo 'strlen(htmlentities($input, ENT_QUOTES)):' . "\n"; echo strlen(htmlentities($input, ENT_QUOTES)) . "\n"; echo '--------------------------------------------------------------------' . "\n"; echo 'strlen(htmlentities($input, ENT_QUOTES, \'ISO-8859-1\')):' . "\n"; echo strlen(htmlentities($input, ENT_QUOTES, 'ISO-8859-1')) . "\n"; ?> Expected result: ---------------- NON-EMPTY reuturn value -- Edit bug report at https://bugs.php.net/bug.php?id=64010&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64010&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64010&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64010&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64010&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64010&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64010&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64010&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64010&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64010&r=support Expected behavior: https://bugs.php.net/fix.php?id=64010&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64010&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64010&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64010&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64010&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64010&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64010&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64010&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64010&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64010&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64010&r=mysqlcfg