replace load with loadXML()
authorJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 2 May 2017 12:39:34 +0000 (18:09 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Wed, 3 May 2017 15:10:17 +0000 (20:40 +0530)
CRM/Case/Audit/AuditConfig.php
CRM/Case/XMLRepository.php
CRM/Core/CodeGen/Util/Xml.php
CRM/Utils/Migrate/Import.php

index 3fedba067845af59017d0881c31b8e2b75b4d84b..5065cca44b793881e9b95907214283bee368d843 100644 (file)
@@ -61,9 +61,8 @@ class CRM_Case_Audit_AuditConfig {
     $this->includeRules = array();
 
     $doc = new DOMDocument();
-    $oldValue = libxml_disable_entity_loader(FALSE);
-    $load = $doc->load(dirname(__FILE__) . '/' . $this->filename);
-    libxml_disable_entity_loader($oldValue);
+    $xmlString = file_get_contents(dirname(__FILE__) . '/' . $this->filename);
+    $load = $doc->loadXML($xmlString);
     if ($load) {
       $regions = $doc->getElementsByTagName("region");
       foreach ($regions as $region) {
index 34fc42da55dbfbff823c43ed5e018fac3e42b028..bf6e2c210b3aeb686e2c46b5771370b82c94eb95 100644 (file)
@@ -136,9 +136,9 @@ class CRM_Case_XMLRepository {
     if ($fileName && file_exists($fileName)) {
       // read xml file
       $dom = new DomDocument();
-      $oldValue = libxml_disable_entity_loader(FALSE);
-      $dom->load($fileName);
-      libxml_disable_entity_loader($oldValue);
+      $xmlString = file_get_contents($fileName);
+      $dom->loadXML($xmlString);
+      $dom->documentURI = $fileName;
       $dom->xinclude();
       $fileXml = simplexml_import_dom($dom);
     }
index aa3335581e9796ac51923192946606dc13d32da8..96f94477e9a6acba81037d2fd3bc19381449861d 100644 (file)
@@ -11,10 +11,10 @@ class CRM_Core_CodeGen_Util_Xml {
    * @return SimpleXMLElement|bool
    */
   public static function parse($file) {
-    $oldValue = libxml_disable_entity_loader(FALSE);
     $dom = new DomDocument();
-    $dom->load($file);
-    libxml_disable_entity_loader($oldValue);
+    $xmlString = file_get_contents($file);
+    $dom->loadXML($xmlString);
+    $dom->documentURI = $file;
     $dom->xinclude();
     $xml = simplexml_import_dom($dom);
     return $xml;
index 29397a960fb43532bd338016b84b834776c6a497..d7905959015150413b68bdba19ad2473410d10b7 100644 (file)
@@ -48,9 +48,8 @@ class CRM_Utils_Migrate_Import {
   public function run($file) {
     // read xml file
     $dom = new DomDocument();
-    $oldValue = libxml_disable_entity_loader(FALSE);
-    $load = $dom->load($file);
-    libxml_disable_entity_loader($oldValue);
+    $xmlString = file_get_contents($file);
+    $load = $dom->loadXML($xmlString);
     if (!$load) {
       throw new CRM_Core_Exception("Failed to parse XML file \"$file\"");
     }