From 03c04a95a2e75a014bc5cdfd3500e4c3856806bc Mon Sep 17 00:00:00 2001 From: Christopher Date: Wed, 26 Nov 2025 13:47:56 +0100 Subject: [PATCH] fix: replace deprecated ArrayAccess methods (attach/detach/contains) for PHP 8.5 compatibility --- .../Injector/RemoveSpansWithoutAttributes.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php b/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php index 42d514447..15c89eb9f 100644 --- a/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php +++ b/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php @@ -74,7 +74,8 @@ public function handleElement(&$token) if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') { // Mark closing span tag for deletion - $this->markForDeletion->attach($current); + // PHP 8.5 compatiblity: replaced attach() with offsetSet() + $this->markForDeletion->offsetSet($current); // Delete open span tag $token = false; } @@ -85,8 +86,11 @@ public function handleElement(&$token) */ public function handleEnd(&$token) { - if ($this->markForDeletion->contains($token)) { - $this->markForDeletion->detach($token); + // PHP 8.5 compatiblity: + // replaced contains() with offsetExists() + // replaced detach() with offsetUnset() + if ($this->markForDeletion->offsetExists($token)) { + $this->markForDeletion->offsetUnset($token); $token = false; } }