|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-24 09:23 UTC] judas dot iscariote at gail dot com
[2007-05-24 09:25 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 20:00:02 2026 UTC |
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.