diff --git a/library/HTMLPurifier/Filter/YouTube.php b/library/HTMLPurifier/Filter/YouTube.php
index 276d8362..d86509ce 100644
--- a/library/HTMLPurifier/Filter/YouTube.php
+++ b/library/HTMLPurifier/Filter/YouTube.php
@@ -19,7 +19,7 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
$pre_regex = '##s';
$pre_replace = '\1';
- return preg_replace($pre_regex, $pre_replace, $html);
+ return preg_replace($pre_regex, $pre_replace, (string)$html);
}
/**
@@ -31,7 +31,7 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
public function postFilter($html, $config, $context)
{
$post_regex = '#((?:v|cp)/[A-Za-z0-9\-_=]+)#';
- return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
+ return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), (string)$html);
}
/**