From a17660fbd08d5075daa17f98a09ff86eadd64d04 Mon Sep 17 00:00:00 2001 From: aude Date: Tue, 23 Oct 2012 15:42:20 +0000 Subject: [PATCH] per bug 41244 and 41303, handle null or false params in TextContent constructor Instead of throwing exception in these cases (which there are use cases for), create an empty TextContent object. Change-Id: Ice30ea78428d95805aa56cd3a35405aa67ad10ab --- includes/content/TextContent.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php index 74c5a882cd..048ac396d3 100644 --- a/includes/content/TextContent.php +++ b/includes/content/TextContent.php @@ -32,6 +32,10 @@ class TextContent extends AbstractContent { public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) { parent::__construct( $model_id ); + if ( $text === null || $text === false ) { + $text = ''; + } + if ( !is_string( $text ) ) { throw new MWException( "TextContent expects a string in the constructor." ); } -- 2.20.1