CRM-20171: avoid warning while loading external entity
authorJitendra Purohit <jitendra@fuzion.co.nz>
Thu, 27 Apr 2017 11:10:42 +0000 (16:40 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Fri, 28 Apr 2017 08:23:43 +0000 (13:53 +0530)
CRM/Case/Audit/AuditConfig.php
CRM/Case/XMLRepository.php
CRM/Core/CodeGen/Util/Xml.php
CRM/Utils/Migrate/Import.php

index 14bc772ff168062a371318b0ca376eac8ebaa36d..3fedba067845af59017d0881c31b8e2b75b4d84b 100644 (file)
@@ -61,7 +61,10 @@ class CRM_Case_Audit_AuditConfig {
     $this->includeRules = array();
 
     $doc = new DOMDocument();
-    if ($doc->load(dirname(__FILE__) . '/' . $this->filename)) {
+    $oldValue = libxml_disable_entity_loader(FALSE);
+    $load = $doc->load(dirname(__FILE__) . '/' . $this->filename);
+    libxml_disable_entity_loader($oldValue);
+    if ($load) {
       $regions = $doc->getElementsByTagName("region");
       foreach ($regions as $region) {
         $regionName = $region->getAttribute("name");
index 89dcce5ce4af0b65e4f1b22b674b81aee38a8a91..34fc42da55dbfbff823c43ed5e018fac3e42b028 100644 (file)
@@ -136,7 +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);
       $dom->xinclude();
       $fileXml = simplexml_import_dom($dom);
     }
index 4711fdc472a24c79faa8d59b8392d8ace7dbe8f2..aa3335581e9796ac51923192946606dc13d32da8 100644 (file)
@@ -11,8 +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);
     $dom->xinclude();
     $xml = simplexml_import_dom($dom);
     return $xml;
index 311fb4516d4e7e96df4af3d335dcee21f61df966..29397a960fb43532bd338016b84b834776c6a497 100644 (file)
@@ -48,7 +48,10 @@ class CRM_Utils_Migrate_Import {
   public function run($file) {
     // read xml file
     $dom = new DomDocument();
-    if (!$dom->load($file)) {
+    $oldValue = libxml_disable_entity_loader(FALSE);
+    $load = $dom->load($file);
+    libxml_disable_entity_loader($oldValue);
+    if (!$load) {
       throw new CRM_Core_Exception("Failed to parse XML file \"$file\"");
     }
     $dom->xinclude();