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;
}
}