]> granicus.if.org Git - php/commitdiff
Fixed bug #47856 (stristr() converts needle to lower-case).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 1 Apr 2009 14:00:38 +0000 (14:00 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 1 Apr 2009 14:00:38 +0000 (14:00 +0000)
NEWS
ext/standard/string.c

diff --git a/NEWS b/NEWS
index 77ffe8cca1aa0be43daa9207b96de1d5e5dac364..b6af37b2792844de78d11cf8161394276e6b1753 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP                                                                        NEWS
 - Undeprecated ticks. (Arnaud)
 - Upgraded bundled sqlite to version 3.6.12. (Scott)
 
+- Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia)
 - Fixed bug #47819 (Getting pdo_mysql.so: undefined symbol: mysqlnd_debug_init
   at startup). (Johannes)
 - Fixed bug #47816 (pcntl tests failing on NetBSD). (Matteo)
index 458cd4d3acff5f5929032e7aa88d1bf559e69043..61a6fbf6223acbff3f56dfc4dacf28e524aad6ed 100644 (file)
@@ -1595,13 +1595,15 @@ PHP_FUNCTION(stristr)
        haystack_orig = estrndup(Z_STRVAL_PP(haystack), Z_STRLEN_PP(haystack));
 
        if (Z_TYPE_PP(needle) == IS_STRING) {
+               char *orig_needle;
                if (!Z_STRLEN_PP(needle)) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
                        efree(haystack_orig);
                        RETURN_FALSE;
                }
-
-               found = php_stristr(Z_STRVAL_PP(haystack), Z_STRVAL_PP(needle), Z_STRLEN_PP(haystack), Z_STRLEN_PP(needle));
+               orig_needle = estrndup(Z_STRVAL_PP(needle), Z_STRLEN_PP(needle));
+               found = php_stristr(Z_STRVAL_PP(haystack), orig_needle, Z_STRLEN_PP(haystack), Z_STRLEN_PP(needle));
+               efree(orig_needle);
        } else {
                SEPARATE_ZVAL(needle);
                convert_to_long(*needle);