tony2001 Fri May 20 10:24:17 2005 EDT
Added files: (Branch: PHP_5_0)
/php-src/ext/standard/tests/strings bug33076.phpt
Modified files:
/php-src/ext/standard string.c
/php-src NEWS
Log:
MFH:
fix bug #33076 (str_ireplace() incorrectly counts result string length and
may cause segfault)
add test
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.420.2.7&r2=1.420.2.8&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.420.2.7
php-src/ext/standard/string.c:1.420.2.8
--- php-src/ext/standard/string.c:1.420.2.7 Sun Apr 3 14:09:23 2005
+++ php-src/ext/standard/string.c Fri May 20 10:24:16 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.420.2.7 2005/04/03 18:09:23 iliaa Exp $ */
+/* $Id: string.c,v 1.420.2.8 2005/05/20 14:24:16 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -2943,7 +2943,7 @@
char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL;
for (source = str; source < source_end; source++) {
- if (*source == from) {
+ if ((case_sensitivity && *source == from) || (!case_sensitivity
&& tolower(*source) == tolower(from))) {
char_count++;
}
}
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.390&r2=1.1760.2.391&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.390 php-src/NEWS:1.1760.2.391
--- php-src/NEWS:1.1760.2.390 Fri May 20 07:15:03 2005
+++ php-src/NEWS Fri May 20 10:24:16 2005
@@ -11,6 +11,8 @@
- Fixed ext/mysqli to allocate less memory when fetching bound params
of type (MEDIUM|LONG)BLOB/(MEDIUM|LONG)TEXT. (Andrey)
- Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey)
+- Fixed bug #33076 (str_ireplace() incorrectly counts result string length
+ and may cause segfault). (Tony)
- Fixed bug #33059 (crash when moving xml attribute set in dtd). (Ilia)
- Fixed bug #33057 (Don't send extraneous entity-headers on a 304 as per
RFC 2616 section 10.3.5) (Rasmus, Choitel)
http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/bug33076.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/strings/bug33076.phpt
+++ php-src/ext/standard/tests/strings/bug33076.phpt
--TEST--
Bug #33076 (str_ireplace() incorrectly counts result string length and may
cause segfault)
--FILE--
<?php
$value = str_ireplace("t", "bz", "Text");
var_dump($value);
echo "Done\n";
?>
--EXPECT--
string(6) "bzexbz"
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php