#41483 [NEW]: str_ireplace causes script to be treated like download

From: Date: Thu, 24 May 2007 08:54:45 +0000
Subject: #41483 [NEW]: str_ireplace causes script to be treated like download
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112982@lists.php.net to get a copy of this message
From: phpbug at p-s dot co dot nz Operating system: Linux PHP version: 5.2.2 PHP Bug Type: *General Issues Bug description: str_ireplace causes script to be treated like download Description: ------------ str_ireplace() causes errors with some particular inputs. If you save the following line into test.php: <?php echo str_ireplace("\r", '', 'interclub_test@p-s.co.nz'); ?> and try to load it in a browser, the browser will ask what to do with the php file instead of running it as normal. E.g. "Opening test.php. You have chosen to open test.php which is a: PHP Coder File from: http://www.psal.co.nz. What should Firefox do with this file? etc". A demo is at www.psal.co.nz/test.php. The case sensitive version str_replace() does not have the same problem, and str_ireplace() often works depending what is thrown at it. Actually the PHP version is 5.2.1 but I can't upgrade to the latest for testing because I am using shared hosting and they use 5.2.1. I apologise if the bug has vanished in a more recent version but this is pretty easy to test. Reproduce code: --------------- <?php echo str_ireplace("\r", '', 'interclub_test@p-s.co.nz'); ?> Expected result: ---------------- interclub_test@p-s.co.nz Actual result: -------------- The browser will ask what to do with the php file. E.g. "Opening test.php. You have chosen to open test.php which is a: PHP Coder File from: http://www.psal.co.nz. What should Firefox do with this file?" etc. -- Edit bug report at http://bugs.php.net/?id=41483&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41483&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41483&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41483&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41483&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41483&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41483&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41483&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41483&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41483&r=support Expected behavior: http://bugs.php.net/fix.php?id=41483&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41483&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41483&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41483&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41483&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41483&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41483&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41483&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41483&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41483&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41483&r=mysqlcfg

« previous php.bugs (#112982) next »