Skip to content

Commit

Permalink
fix: Deprecated: preg_replace(): Passing null to parameter #3 ($subje…
Browse files Browse the repository at this point in the history
…ct) o… (#421)

Co-authored-by: Edward Z. Yang <[email protected]>
  • Loading branch information
nikkii94 and ezyang authored Nov 10, 2024
1 parent d515007 commit 5d154a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/HTMLPurifier/Filter/YouTube.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function preFilter($html, $config, $context)
$pre_regex = '#<object[^>]+>.+?' .
'(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s';
$pre_replace = '<span class="youtube-embed">\1</span>';
return preg_replace($pre_regex, $pre_replace, $html);
return preg_replace($pre_regex, $pre_replace, (string)$html);
}

/**
Expand All @@ -31,7 +31,7 @@ public function preFilter($html, $config, $context)
public function postFilter($html, $config, $context)
{
$post_regex = '#<span class="youtube-embed">((?:v|cp)/[A-Za-z0-9\-_=]+)</span>#';
return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), (string)$html);
}

/**
Expand Down

0 comments on commit 5d154a2

Please sign in to comment.