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 <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf
2026-07-11 21:37:25 +02:00
parent 228bc7ee1d
commit 76547fef78
+3 -1
View File
@@ -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;