Skip to content

Commit

Permalink
replace load with loadXML()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jitendra Purohit committed May 2, 2017
1 parent 6498e0d commit 80d97a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions CRM/Case/Audit/AuditConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ public function loadConfig() {
$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) {
Expand Down
5 changes: 2 additions & 3 deletions CRM/Case/XMLRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ public function retrieveFile($caseType) {
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->xinclude();
$fileXml = simplexml_import_dom($dom);
}
Expand Down
5 changes: 2 additions & 3 deletions CRM/Core/CodeGen/Util/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ 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->xinclude();
$xml = simplexml_import_dom($dom);
return $xml;
Expand Down
5 changes: 2 additions & 3 deletions CRM/Utils/Migrate/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public function __construct() {
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\"");
}
Expand Down

0 comments on commit 80d97a8

Please sign in to comment.