From ad34744272d29fafab1f6b0e3f8e4725f8abd140 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 16 Jun 2023 11:16:22 -0600 Subject: [PATCH] Use is_xml instead of simplexml_load_string Reason for the change is it was throwing and error. Also using regex is less resource intensive. Using this to determine the content type. --- app/provision/index.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index 0cfdcd4bcf..db34119c5e 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -465,15 +465,14 @@ header("Content-Length: ".strlen($file_contents)); } else { - $result = simplexml_load_string ($file_contents, 'SimpleXmlElement', LIBXML_NOERROR+LIBXML_ERR_FATAL+LIBXML_ERR_NONE); - if (false == $result) { - header("Content-Type: text/plain"); - header("Content-Length: ".strval(strlen($file_contents))); - } - else { + if (is_xml($file_contents)) { header("Content-Type: text/xml; charset=utf-8"); header("Content-Length: ".strlen($file_contents)); } + else { + header("Content-Type: text/plain"); + header("Content-Length: ".strval(strlen($file_contents))); + } } } echo $file_contents;