Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
}
Expand Down
Loading