Instantiating a TextContent instance around a null or false value
instead of a string may indicate an error and should thus trigger
a warning and thereby make tests fail.
Change-Id: I0864bbf31040d0c5db96a90ff427dc9dd3ccbd67
public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) {
parent::__construct( $model_id );
+ if ( $text === null || $text === false ) {
+ wfWarn( "TextContent constructed with \$text = " . var_export( $text, true ) . "! "
+ . "This may indicate an error in the caller's scope." );
+
+ $text = '';
+ }
+
if ( !is_string( $text ) ) {
throw new MWException( "TextContent expects a string in the constructor." );
}