]> granicus.if.org Git - php/commitdiff
@- stristr() no longer modifies it's arguments. (Thies)
authorThies C. Arntzen <thies@php.net>
Wed, 22 Mar 2000 08:14:00 +0000 (08:14 +0000)
committerThies C. Arntzen <thies@php.net>
Wed, 22 Mar 2000 08:14:00 +0000 (08:14 +0000)
fix #3890

ext/standard/string.c

index 8ccd27616e38efdbf4b470174924195b3a08e813..ba9a672fd2c6f5d706ba65d6c1d69f8542f0b34b 100644 (file)
@@ -579,6 +579,9 @@ PHP_FUNCTION(stristr)
                FAILURE) {
                WRONG_PARAM_COUNT;
        }
+
+       SEPARATE_ZVAL(haystack);
+       SEPARATE_ZVAL(needle);
        convert_to_string_ex(haystack);
 
        if ((*needle)->type == IS_STRING) {
@@ -586,12 +589,14 @@ PHP_FUNCTION(stristr)
                        php_error(E_WARNING,"Empty delimiter");
                        RETURN_FALSE;
                }
+
                found = php_stristr((*haystack)->value.str.val, (*needle)->value.str.val,
                                                        (*haystack)->value.str.len, (*needle)->value.str.len);
        } else {
                convert_to_long_ex(needle);
                needle_char[0] = tolower((char) (*needle)->value.lval);
                needle_char[1] = '\0';
+
                found = php_stristr((*haystack)->value.str.val, needle_char,
                                            (*haystack)->value.str.len, 1);
        }