Skip to content

Commit 6d44e49

Browse files
committed
Update
1 parent b010e39 commit 6d44e49

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/class-xml-file.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ function load($file)
141141
$this->Doc = new DomDocument;
142142
$res = false;
143143
try {
144-
$res = $this->Doc->load($file);
144+
$tmpDoc = $this->Doc;
145+
$res = xml_file::protected_file_operation($file, "r", function ($fp) use ($tmpDoc, $file) {
146+
return $tmpDoc->load($file);
147+
});
145148
} catch (Exception $e) {
146149
$this->err = $e->getMessage();
147150
$res = false;
@@ -401,7 +404,9 @@ public static function FileToDoc($f)
401404
if (!is_string($f)) throw new Exception("Invalid argument 1 to FileToDoc. Expected filename, got " . print_r($f, true));
402405
if (!file_exists($f)) throw new Exception("File not found: $f");
403406
$D = new DOMDocument;
404-
$D->load($f);
407+
xml_file::protected_file_operation($f, "r", function ($fp) use ($D, $f) {
408+
$D->load($f);
409+
});
405410
return $D;
406411
}
407412

0 commit comments

Comments
 (0)