aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Sam Edwards <sam@samedwards.ca> 2025-07-16 16:44:10 -0700
committerGravatar GitHub <noreply@github.com> 2025-07-17 01:44:10 +0200
commit5bbd299c7e3d38ffc6d3e618054ca288f947a203 (patch)
tree2bdbd12fe59bce90156dbc9d23667670904e2d66 /lib
parent5489d864f6e7207e41a48145aef9ec136944d70f (diff)
Call DOMNode::insertBefore() on the parent of it's $child (#7741)
Follow-up to https://github.com/FreshRSS/FreshRSS/pull/7654#discussion_r2208901108 Changes proposed in this pull request: - `DOMNode::insertBefore()` needs to be called on an element that is the parent of the `$child` param being passed - Update code to call this on `$doc->documentElement` instead of directly on the `$doc` (`DOMDocument`) How to test the feature manually: 1. Set up an HTML + XPath feed for a URL that contains partial HTML content (eg. https://victoria.citified.ca/modules/blog/news.php?n=7&c=8) 1. Observe that the feed is processed successfully without error, and that the `<base>` is still inserted
Diffstat (limited to 'lib')
-rw-r--r--lib/lib_rss.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 196ab06a4..0786eb949 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -535,7 +535,7 @@ function enforceHtmlBase(string $html, string $href): string {
if ($head instanceof DOMElement) {
$head->insertBefore($base, $head->firstChild);
} else {
- $doc->insertBefore($base, $doc->documentElement->firstChild);
+ $doc->documentElement->insertBefore($base, $doc->documentElement->firstChild);
}
}
return $doc->saveHTML() ?: $html;