com php-src: Remove unnecessary haystack length check in stripos(): ext/standard/string.c

From: Date: Sun, 25 Aug 2019 14:31:15 +0000
Subject: com php-src: Remove unnecessary haystack length check in stripos(): ext/standard/string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108034@lists.php.net to get a copy of this message
Commit: 6e3135070c13293c2f5f4d8a22ec282fd00f3f21 Author: Nikita Popov <nikita.ppv@gmail.com> Sun, 25 Aug 2019 16:31:15 +0200 Parents: 4346d1b0e66e99809ba7ad9592198f79f673e744 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6e3135070c13293c2f5f4d8a22ec282fd00f3f21 Log: Remove unnecessary haystack length check in stripos() 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. Changed paths: M ext/standard/string.c Diff: diff --git a/ext/standard/string.c b/ext/standard/string.c index 4ec66e3..0ddc1f6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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; }

« previous php.cvs (#108034) next »