Skip to content

Commit 5d154a2

Browse files
nikkii94ezyang
andauthored
fix: Deprecated: preg_replace(): Passing null to parameter #3 ($subject) o… (#421)
Co-authored-by: Edward Z. Yang <ezyang@meta.com>
1 parent d515007 commit 5d154a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/HTMLPurifier/Filter/YouTube.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function preFilter($html, $config, $context)
1919
$pre_regex = '#<object[^>]+>.+?' .
2020
'(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s';
2121
$pre_replace = '<span class="youtube-embed">\1</span>';
22-
return preg_replace($pre_regex, $pre_replace, $html);
22+
return preg_replace($pre_regex, $pre_replace, (string)$html);
2323
}
2424

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

3737
/**

0 commit comments

Comments
 (0)