diff --git a/lib/private/security/stringutils.php b/lib/private/security/stringutils.php
index 33a3a7080123e1e418d7505feeb1001f34caee69..ecba655ebd65ac9d109205a240138d2f4fb383dd 100644
--- a/lib/private/security/stringutils.php
+++ b/lib/private/security/stringutils.php
@@ -25,6 +25,10 @@ class StringUtils {
 	 */
 	public static function equals($expected, $input) {
 
+		if(!is_string($expected) || !is_string($input)) {
+			return false;
+		}
+
 		if(function_exists('hash_equals')) {
 			return hash_equals($expected, $input);
 		}