Skip to content

Commit 828ef4f

Browse files
committed
Fix #5 : Specify all arguments for Document ctor
- Add type check to ensure $page->content() is a string - Add all arguments to DiDom\Document constructor call
1 parent d7457e1 commit 828ef4f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lazy-image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function isValidClass($c = "")
103103

104104
protected function updateImages($content)
105105
{
106-
if(trim($content) === '')
106+
if(!is_string($content) || trim($content) === '')
107107
{
108108
return;
109109
}
@@ -112,7 +112,7 @@ protected function updateImages($content)
112112

113113
if($this->isValidClass($class_for_images))
114114
{
115-
$document = new Document($content);
115+
$document = new Document($content, false, 'UTF-8', 'html');
116116
if (count($images = $document->find("img.".$class_for_images)) > 0) {
117117
foreach ($images as $image) {
118118
if(!$image->getAttribute("data-src")) {

0 commit comments

Comments
 (0)