pollita Fri Mar 26 14:23:42 2004 EDT
Added files:
/php-src/ext/standard/tests/strings bug27675.phpt
Modified files:
/php-src/ext/standard string.c
Log:
BugFix 27675 and add regression test.
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.413&r2=1.414&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.413 php-src/ext/standard/string.c:1.414
--- php-src/ext/standard/string.c:1.413 Thu Mar 18 04:48:37 2004
+++ php-src/ext/standard/string.c Fri Mar 26 14:23:42 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.413 2004/03/18 09:48:37 dmitry Exp $ */
+/* $Id: string.c,v 1.414 2004/03/26 19:23:42 pollita Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -3005,6 +3005,13 @@
}
return new_str;
} else {
+ if (!case_sensitivity) {
+ haystack_dup = estrndup(haystack, length);
+ needle_dup = estrndup(needle, needle_len);
+ php_strtolower(haystack_dup, length);
+ php_strtolower(needle_dup, needle_len);
+ }
+
if (str_len < needle_len) {
new_str = emalloc(length + 1);
} else {
@@ -3015,10 +3022,6 @@
o = haystack;
n = needle;
} else {
- haystack_dup = estrndup(haystack, length);
- needle_dup = estrndup(needle, needle_len);
- php_strtolower(haystack_dup, length);
- php_strtolower(needle_dup, needle_len);
o = haystack_dup;
n = needle_dup;
}
http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/bug27675.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/strings/bug27675.phpt
+++ php-src/ext/standard/tests/strings/bug27675.phpt
--TEST--
Bug #27675 (str_ireplace segfaults when shrinking string)
--FILE--
<?php
echo str_ireplace('/*<B>', '<B>', '/*<b> I am a comment</b>*/');
?>
--EXPECT--
<B> I am a comment</b>*/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php