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

From: Date: Thu, 24 May 2007 09:23:27 +0000
Subject: #41483 [Com]: str_ireplace causes script to be treated like download
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112986@lists.php.net to get a copy of this message
ID: 41483 Comment by: judas dot iscariote at gail dot com Reported By: phpbug at p-s dot co dot nz Status: Open Bug Type: *General Issues Operating System: Linux PHP Version: 5.2.2 New Comment: This issue is already reported and fixed in PHP 5.2.2 , do not report stuff more than once. Previous Comments: ------------------------------------------------------------------------ [2007-05-24 08:54:45] phpbug at p-s dot co dot nz 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 this bug report at http://bugs.php.net/?id=41483&edit=1

« previous php.bugs (#112986) next »