Fix utils::StartsWith when needle bigger that value

This commit is contained in:
Pierre Goiffon
2019-11-22 14:43:26 +01:00
parent 730a0d1c98
commit c203e6c7be

View File

@@ -2086,6 +2086,11 @@ class utils
*/
final public static function StartsWith($haystack, $needle)
{
if (strlen($needle) > strlen($haystack))
{
return false;
}
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
}