From: Operating system: PHP version: 5.4.0RC8 Package: Unknown/Other Function Bug Type: Bug Bug description:htmlspecialchars() silently failing
Description: ------------ htmlspecialchars() no longer provides warnings in PHP 5.4 This is specially worrying as 5.4 changes its default charset from ISO-8859-1 to UTF-8. So the same string that passed flawlessly through 5.3, will now silently output nothing in 5.4 (and htmlspecialchars is one of the last things to check!). In 5.3 the following can produce: var_dump( htmlspecialchars("a\237a", ENT_COMPAT, 'UTF-8') ); PHP Warning: htmlspecialchars(): Invalid multibyte sequence in argument in php shell code on line 1 string(0) "" whereas in 5.4: var_dump( htmlspecialchars("a\237a", ENT_COMPAT, 'UTF-8') ); string(0) "" The explicit UTF-8 is to make both work the same, htmlspecialchars("a\237a") *works* in 5.3 (but it may not be in your page encoding). The reason is clear, php_error_docref() of php_escape_html_entities_ex is gone in 5.4 and trunk. I attach a patch against 5.4 branch readding the warning (should apply fine in trunk, moved 5 lines below) -- Edit bug report at https://bugs.php.net/bug.php?id=61228&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61228&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61228&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61228&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61228&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61228&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61228&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61228&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61228&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61228&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61228&r=support Expected behavior: https://bugs.php.net/fix.php?id=61228&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61228&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61228&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61228&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61228&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61228&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61228&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61228&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61228&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61228&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61228&r=mysqlcfg