about summary refs log tree commit diff stats
path: root/classes/Sanitizer.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-05-24 17:16:05 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-05-24 17:16:05 +0300
commit6f660eedb640eaa31e75cfd2543692d7f494ddd6 (patch)
treebf5a6d43ae77daf7a63d5c1770ec5dac6af5bc06 /classes/Sanitizer.php
parent8ca1fb36999b0e2eceed1388d1a1f7cc115a2f3c (diff)
downloadthe-epube-6f660eedb640eaa31e75cfd2543692d7f494ddd6.tar.gz
the-epube-6f660eedb640eaa31e75cfd2543692d7f494ddd6.tar.xz
fix phpstan issues
Diffstat (limited to 'classes/Sanitizer.php')
-rw-r--r--classes/Sanitizer.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/classes/Sanitizer.php b/classes/Sanitizer.php
index d751245..9d2f5a3 100644
--- a/classes/Sanitizer.php
+++ b/classes/Sanitizer.php
@@ -19,7 +19,6 @@ class Sanitizer {
 			$rel_parts['host'] = $parts['host'];
 			$rel_parts['scheme'] = $parts['scheme'];
 
-			/** @phpstan-ignore-next-line */
 			if (isset($rel_parts['path'])) {
 				if (strpos($rel_parts['path'], '/') !== 0)
 					$rel_parts['path'] = '/' . $rel_parts['path'];
@@ -47,6 +46,7 @@ class Sanitizer {
 		$entries = $xpath->query('(//a[@href]|//img[@src]|//source[@srcset|@src])');
 
 		foreach ($entries as $entry) {
+		/** @var DOMElement $entry */
 
 			if ($entry->hasAttribute('href')) {
 				$entry->setAttribute('href',
@@ -109,10 +109,13 @@ class Sanitizer {
 		$entries = $xpath->query('//*');
 
 		foreach ($entries as $entry) {
+		/** @var DOMElement $entry */
 			if (!in_array($entry->nodeName, $allowed_elements)) {
 				$entry->parentNode->removeChild($entry);
+				continue;
 			}
 
+
 			if ($entry->hasAttributes()) {
 				$attrs_to_remove = array();