From 76547fef782b4e72e49bf036adf479efce2f9e72 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Thu, 18 Jun 2026 17:42:57 +0200 Subject: [PATCH] Prevent Readability::init() from resetting DOM if already set Letting init() resetting the DOM may lead to unexpected behaviors in libraries like Graby. Related to https://github.com/j0k3r/graby/pull/392 Signed-off-by: Kevin Decherf --- src/Readability.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Readability.php b/src/Readability.php index 0c9f44e..dd8f83a 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -213,7 +213,9 @@ class Readability implements LoggerAwareInterface */ public function init(): bool { - $this->loadHtml(); + if (!isset($this->dom)) { + $this->loadHtml(); + } if (!isset($this->dom->documentElement)) { return false;