]> granicus.if.org Git - php/commitdiff
Remove unnecessary haystack length check in stripos()
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 25 Aug 2019 14:31:15 +0000 (16:31 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 25 Aug 2019 14:31:15 +0000 (16:31 +0200)
This falls out naturally from the following condition, because
either the needle length will be zero as well, or the needle
will be longer than the (empty) haystack.

ext/standard/string.c

index 4ec66e35bfdc4d76122e9a24baad670e96d47008..0ddc1f695680ae7871e1a9afff8e18761df9f011 100644 (file)
@@ -1940,10 +1940,6 @@ PHP_FUNCTION(stripos)
                RETURN_FALSE;
        }
 
-       if (ZSTR_LEN(haystack) == 0) {
-               RETURN_FALSE;
-       }
-
        if (ZSTR_LEN(needle) == 0 || ZSTR_LEN(needle) > ZSTR_LEN(haystack)) {
                RETURN_FALSE;
        }