#45440 [NEW]: preg_replace does not do replacements inside $subject

From: Date: Sun, 06 Jul 2008 15:22:19 +0000
Subject: #45440 [NEW]: preg_replace does not do replacements inside $subject
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-935@lists.php.net to get a copy of this message
From: aremo at ngi dot it Operating system: Linux PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: preg_replace does not do replacements inside $subject Description: ------------ Probably a documentation bug. The manual page for preg_replace (especially in the description of $subject) makes it sound as though the replacements were made directly on $subject, while this is not the case. The replacements are only in the returned string. Reproduce code: --------------- #!/usr/bin/php <?php $subject = "big"; $result = preg_replace('#i#','u',$subject); echo $subject.' '.$result; ?> Expected result: ---------------- If the replacement took place in $subject, the program should output "bug bug". Actual result: -------------- The program outputs "big bug". -- Edit bug report at http://bugs.php.net/?id=45440&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45440&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45440&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45440&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45440&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45440&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45440&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45440&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45440&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45440&r=support Expected behavior: http://bugs.php.net/fix.php?id=45440&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45440&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45440&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45440&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45440&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45440&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45440&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45440&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45440&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45440&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45440&r=mysqlcfg

« previous php.doc.bugs (#935) next »