#24784 [NEW]: str_replace count paramater only counts replacements when strlen > 1

From: Date: Thu, 24 Jul 2003 02:14:27 +0000
Subject: #24784 [NEW]: str_replace count paramater only counts replacements when strlen > 1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44627@lists.php.net to get a copy of this message
From: philip at cornado dot com Operating system: linux PHP version: 5CVS-2003-07-23 (dev) PHP Bug Type: Strings related Bug description: str_replace count paramater only counts replacements when strlen > 1 Description: ------------ str_[i]replace() has a count parameter that returns a variable (by reference) with a count of replacements. This is not counting when the search string is one character in length. Reproduce code: --------------- <?php $count = 0; $str = str_replace('a', '', 'apples are good', $count); echo $count; ?> Expected result: ---------------- 2 -- Edit bug report at http://bugs.php.net/?id=24784&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24784&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24784&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24784&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24784&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24784&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24784&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24784&r=support Expected behavior: http://bugs.php.net/fix.php?id=24784&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24784&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24784&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24784&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24784&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24784&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24784&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24784&r=gnused

« previous php.bugs (#44627) next »