Skip to content

Commit 702ee65

Browse files
committed
Fix deprecated libxml_disable_entity_loader
1 parent fc66039 commit 702ee65

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Crawler.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ public function addContent($content, $type = null)
182182
public function addHtmlContent($content, $charset = 'UTF-8')
183183
{
184184
$internalErrors = libxml_use_internal_errors(true);
185-
$disableEntities = libxml_disable_entity_loader(true);
185+
if (LIBXML_VERSION < 20900) {
186+
$disableEntities = libxml_disable_entity_loader(true);
187+
}
186188

187189
$dom = new \DOMDocument('1.0', $charset);
188190
$dom->validateOnParse = true;
@@ -203,7 +205,9 @@ public function addHtmlContent($content, $charset = 'UTF-8')
203205
}
204206

205207
libxml_use_internal_errors($internalErrors);
206-
libxml_disable_entity_loader($disableEntities);
208+
if (LIBXML_VERSION < 20900) {
209+
libxml_disable_entity_loader($disableEntities);
210+
}
207211

208212
$this->addDocument($dom);
209213

@@ -246,7 +250,9 @@ public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NO
246250
}
247251

248252
$internalErrors = libxml_use_internal_errors(true);
249-
$disableEntities = libxml_disable_entity_loader(true);
253+
if (LIBXML_VERSION < 20900) {
254+
$disableEntities = libxml_disable_entity_loader(true);
255+
}
250256

251257
$dom = new \DOMDocument('1.0', $charset);
252258
$dom->validateOnParse = true;
@@ -256,7 +262,9 @@ public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NO
256262
}
257263

258264
libxml_use_internal_errors($internalErrors);
259-
libxml_disable_entity_loader($disableEntities);
265+
if (LIBXML_VERSION < 20900) {
266+
libxml_disable_entity_loader($disableEntities);
267+
}
260268

261269
$this->addDocument($dom);
262270

0 commit comments

Comments
 (0)