]> granicus.if.org Git - php/commitdiff
Make sure haystack_len is initialized before it's used
authorFrank M. Kromann <fmk@php.net>
Fri, 28 Oct 2005 19:29:29 +0000 (19:29 +0000)
committerFrank M. Kromann <fmk@php.net>
Fri, 28 Oct 2005 19:29:29 +0000 (19:29 +0000)
ext/standard/string.c

index 65158ed635d53e0f2c40a9232276c298b9747671..33c88eae305b406e22f442ec2077ea398f52d6e8 100644 (file)
@@ -2404,6 +2404,7 @@ PHP_FUNCTION(stripos)
                RETURN_FALSE;
        }
 
+       haystack_len = Z_UNILEN_P(haystack);
        if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_BINARY || Z_TYPE_P(needle) == IS_STRING) {
                if (!Z_UNILEN_P(needle)) {
                        RETURN_FALSE;
@@ -2418,7 +2419,6 @@ PHP_FUNCTION(stripos)
                                convert_to_explicit_type(needle, str_type);
                        }
                }
-               haystack_len = Z_UNILEN_P(haystack);
                needle_len = Z_UNILEN_P(needle);
                if (Z_TYPE_P(haystack) == IS_UNICODE) {
                        haystack_dup = eustrndup(Z_USTRVAL_P(haystack), haystack_len);