From 85ce83ff39c9f438a5c71a5575bb3c312497f4f2 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 12 May 2017 19:00:16 +0000 Subject: [PATCH] * outputxml: if the provided data are XML, do not change them and just display them with the headers git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3655 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- outputxml.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/outputxml.php b/outputxml.php index 9a4f7cc..06a23c9 100644 --- a/outputxml.php +++ b/outputxml.php @@ -17,13 +17,22 @@ class outputxml extends output @header('Cache-Control: post-check=0, pre-check=0', false); @header('Pragma: no-cache'); @header ("Content-Type: text/xml"); - $xml = new SimpleXMLElement (""); - // function call to convert array to xml - if (!is_array ($data)) - $data = array ($data); - $this->array_to_xml ($data, $xml); - //saving generated xml file - print $xml->asXML(); + if (is_string ($data) && substr ($data, 0, 6) === ""); + // function call to convert array to xml + if (!is_array ($data)) + $data = array ($data); + $this->array_to_xml ($data, $xml); + //saving generated xml file + print $xml->asXML(); + } if (!defined ("PHPUNIT")) exit; }