diff --git a/php/HtmlSnippet.php b/php/HtmlSnippet.php
index <HASH>..<HASH> 100644
--- a/php/HtmlSnippet.php
+++ b/php/HtmlSnippet.php
@@ -22,6 +22,9 @@ class HtmlSnippet {
 	 * @param string $content HTML snippet
 	 */
 	public function __construct( $content ) {
+		if ( !is_string( $content ) ) {
+			throw new Exception( 'Content passed to HtmlSnippet must be a string' );
+		}
 		$this->content = $content;
 	}
HtmlSnippet: Throw exception if given non-string content

Otherwise we will end up with a PHP fatal error somewhere later when
we try to stringify the HtmlSnippet object. An exception when
constructing it is easier to debug.

Change-Id: Id6e0d<I>a<I>b8f<I>e6ae<I>bb<I>d0e<I>fbc