From 8cddb9969148cf802691f20c8906c573d03d7f21 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 14 Feb 2024 22:19:37 +0200 Subject: [PATCH] update xml type detection rule --- README.md | 2 +- src/Manticore.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 64278b8..38dc54b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Versioned drivers to create and read KVAZAR index in different applications ## Install -* `apt install composer manticore php-fpm php-pdo php-xml` +* `apt install composer manticore php-fpm php-pdo` * `composer require kvazar/index:dev-main` ## Usage diff --git a/src/Manticore.php b/src/Manticore.php index 3f951a8..6880f44 100644 --- a/src/Manticore.php +++ b/src/Manticore.php @@ -336,16 +336,16 @@ class Manticore case is_object($value): return self::TYPE_OBJECT; - case is_string($value) && false === mb_detect_encoding((string) $value, null, true): + 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((string) $value, true)) === $value: + case is_string($value) && false === preg_match('/\s/', $value) && base64_encode((string) base64_decode($value, true)) === $value: return self::TYPE_BASE_64; - case is_string($value) && json_encode((string) json_decode((string) $value)) === $value: + case is_string($value) && json_encode(json_decode($value)) === $value: return self::TYPE_JSON; - case is_string($value) && false !== @simplexml_load_string((string) $value): + case is_string($value) && false !== preg_match('/<\/[^>]+>/', $value): return self::TYPE_XML; default: