From: ivb at is dot ua Operating system: Windows XP PHP version: 5.2.0 PHP Bug Type: Strings related Bug description: str_replace() operates wrong on strings containing chr(0)
Description: ------------ If 'search' and 'subject' has equal length and both begins with equal substring with chr(0) inside - str_replace() considers that 'search' and 'subject' equals. Reproduce code: --------------- <?php $search = "qx\0qqqqqqqqqq"; $subject = "qx\0xxxxxxxxxx"; $replace = "any text"; $result = str_replace ( $search, $replace, $subject ); echo $search . "\n" . $replace . "\n" . $subject . "\n" . $result . "\n"; ?> Expected result: ---------------- qx qqqqqqqqqq any text qx xxxxxxxxxx qx xxxxxxxxxx Actual result: -------------- qx qqqqqqqqqq any text qx xxxxxxxxxx any text -- Edit bug report at http://bugs.php.net/?id=39621&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39621&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39621&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39621&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39621&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39621&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39621&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39621&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39621&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39621&r=support Expected behavior: http://bugs.php.net/fix.php?id=39621&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39621&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39621&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39621&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39621&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39621&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39621&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39621&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39621&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39621&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39621&r=mysqlcfg
