cvs: php-src /ext/standard string.c /ext/standard/tests/strings bug33076.phpt
| From: | Antony Dovgal | Date: | Fri, 20 May 2005 14:23:42 +0000 |
| Subject: | cvs: php-src /ext/standard string.c /ext/standard/tests/strings bug33076.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-31936@lists.php.net to get a copy of this message | ||
tony2001 Fri May 20 10:23:42 2005 EDT
Added files:
/php-src/ext/standard/tests/strings bug33076.phpt
Modified files:
/php-src/ext/standard string.c
Log:
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.435&r2=1.436&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.435 php-src/ext/standard/string.c:1.436
--- php-src/ext/standard/string.c:1.435 Sun Apr 3 14:08:37 2005
+++ php-src/ext/standard/string.c Fri May 20 10:23:41 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.435 2005/04/03 18:08:37 iliaa Exp $ */
+/* $Id: string.c,v 1.436 2005/05/20 14:23:41 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -2991,7 +2991,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/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