Bug #68320 [NEW]: str_replace not binary safe

From: Date: Tue, 28 Oct 2014 23:50:06 +0000
Subject: Bug #68320 [NEW]: str_replace not binary safe
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188349@lists.php.net to get a copy of this message
From: zf at ancientrock dot org Operating system: CentOS 6.5 x64 PHP version: 5.6.2 Package: Scripting Engine problem Bug Type: Bug Bug description:str_replace not binary safe Description: ------------ While using str_replace to replace string (CP936 encoding), the result leading bad encoding text output Test script: --------------- <?php //GBK encoding str_replace test; save this file into GBK encoding and run it $str = "退党保平安,你心里有不舒服的时候就说出来,为什么不舒服,女孩子都有点这样的脾气的"; var_dump(str_replace('退党', '**', $str)); Expected result: ---------------- display: 保平安,你心里有不舒服的时候就说出来,为什么不舒服,女孩子都有点这样的脾气的 Actual result: -------------- the text was broken, and can not readable -- Edit bug report at https://bugs.php.net/bug.php?id=68320&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68320&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68320&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68320&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68320&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68320&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68320&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68320&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68320&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68320&r=support Expected behavior: https://bugs.php.net/fix.php?id=68320&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68320&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68320&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68320&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68320&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68320&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68320&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68320&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68320&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68320&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68320&r=mysqlcfg

« previous php.bugs (#188349) next »