From 941693090208c4f9270a4c4696bdca920b798155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 11 Nov 2021 14:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9PHP8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChat/Contracts/Tools.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WeChat/Contracts/Tools.php b/WeChat/Contracts/Tools.php index a31bb8e..5451954 100644 --- a/WeChat/Contracts/Tools.php +++ b/WeChat/Contracts/Tools.php @@ -159,9 +159,8 @@ class Tools */ public static function xml2arr($xml) { - $entity = libxml_disable_entity_loader(true); + if (PHP_VERSION_ID < 80000) libxml_disable_entity_loader(true); $data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); - libxml_disable_entity_loader($entity); return json_decode(json_encode($data), true); }