ID:               27675
 Updated by:       [EMAIL PROTECTED]
 Reported By:      marcel at korton dot nl
-Status:           Assigned
+Status:           Closed
 Bug Type:         Strings related
 Operating System: win XP
 PHP Version:      5.0.0RC1
 Assigned To:      pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Close, but that'd have introduced a leak for str_ireplaces which expand
the length of the string.






Previous Comments:
------------------------------------------------------------------------

[2004-03-25 20:38:45] [EMAIL PROTECTED]

Verified the problem. The following patch fixes it for me.



Index: string.c

===================================================================

RCS file: /repository/php-src/ext/standard/string.c,v

retrieving revision 1.413

diff -u -r1.413 string.c

--- string.c    18 Mar 2004 09:48:37 -0000      1.413

+++ string.c    26 Mar 2004 01:46:19 -0000

@@ -3065,6 +3065,10 @@

                                        e += end - p;

                                }

                        } else {

+                               haystack_dup = estrndup(haystack,
length);

+                               needle_dup = estrndup(needle,
needle_len);

+                               php_strtolower(haystack_dup, length);

+                               php_strtolower(needle_dup,
needle_len);

                                end = haystack_dup + length;



                                for (p = haystack_dup; (r =
php_memnstr(p, needle_dup, needle_len, end)); p = r + needle_len) {



------------------------------------------------------------------------

[2004-03-25 20:00:14] nick at linuxmail dot org

I've noticed this only seems to crash when the replacement string is
not the same length as the searched-for string.

------------------------------------------------------------------------

[2004-03-24 10:24:38] marcel at korton dot nl

Description:
------------
str_ireplace gives an unexpected result

Reproduce code:
---------------
<?php

$strResult = '/*<B>i see this</B>*/';



echo $strResult;



$strResult = str_ireplace('/*<B>', '<B>', $strResult );

        

echo $strResult;

?>



Expected result:
----------------
<B>i see this</B>*/'



Actual result:
--------------
PHP has encountered an Access Violation at 00CB7C21/*i see this*/


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27675&edit=1

Reply via email to