From bd29ff626d2074cc404d01e93ac675bcfa179f2b Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 14 Feb 2024 22:43:13 +0200 Subject: [PATCH] fix preg_match validation --- src/Manticore.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Manticore.php b/src/Manticore.php index 6880f44..9b78f3b 100644 --- a/src/Manticore.php +++ b/src/Manticore.php @@ -339,13 +339,13 @@ class Manticore case is_string($value) && false === mb_detect_encoding($value, null, true): return self::TYPE_BIN; - case is_string($value) && false === preg_match('/\s/', $value) && base64_encode((string) base64_decode($value, true)) === $value: + case is_string($value) && !preg_match('/\s/', $value) && base64_encode((string) base64_decode($value, true)) === $value: return self::TYPE_BASE_64; case is_string($value) && json_encode(json_decode($value)) === $value: return self::TYPE_JSON; - case is_string($value) && false !== preg_match('/<\/[^>]+>/', $value): + case is_string($value) && 1 === preg_match('/<\/[^>]+>/', $value): return self::TYPE_XML; default: