#49861 [NEW]: htmlspecialchars() returns incorrect results for Unicode characters outside BMP

From: Date: Tue, 13 Oct 2009 09:00:42 +0000
Subject: #49861 [NEW]: htmlspecialchars() returns incorrect results for Unicode characters outside BMP
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143519@lists.php.net to get a copy of this message
From: moriyoshi@php.net Operating system: * PHP version: 5.3SVN-2009-10-13 (SVN) PHP Bug Type: Strings related Bug description: htmlspecialchars() returns incorrect results for Unicode characters outside BMP Description: ------------ htmlspecialchars() / htmlentities() returns incorrect results when an Unicode character whose codepoint is outside the range of BMP. Confirmed with 5.3.0, 5.3SVN. Reproduce code: --------------- <?php // U+1003C var_dump(bin2hex(htmlspecialchars("\xf0\x90\x80\xbc", ENT_QUOTES, 'UTF-8')); ?> Expected result: ---------------- string(8) "f09080bc" Actual result: -------------- string(8) "266c743b" -- Edit bug report at http://bugs.php.net/?id=49861&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49861&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49861&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49861&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49861&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49861&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49861&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49861&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49861&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49861&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49861&r=support Expected behavior: http://bugs.php.net/fix.php?id=49861&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49861&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49861&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49861&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49861&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49861&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49861&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49861&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49861&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49861&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49861&r=mysqlcfg

« previous php.bugs (#143519) next »