From c61a678e9ca15f78f67ff9a83ee38bb0794037cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 16 Jul 2015 20:59:11 +0200 Subject: [PATCH] OOUIHTMLForm: Make sure arguments to OOUI\HtmlSnippet are really strings Catchable fatal error: Method OOUI\HtmlSnippet::__toString() must return a string value in /var/www/html/w/vendor/oojs/oojs-ui/php/Element.php on line 245 $this->getHelpText() can return null. Maybe OOUI\HtmlSnippet should be doing the casting instead, but it currently doesn't. Follow-up to 3ec3f08ca5c7bfae820bbc8085eff0809abd688b. Change-Id: I0bb2a1594ea5ffd86bf8abd41c13f9451df256d5 --- includes/htmlform/HTMLFormField.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 3e30d79d59..70615d9d98 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -581,11 +581,12 @@ abstract class HTMLFormField { } $fieldType = get_class( $this ); + $helpText = $this->getHelpText(); $field = new OOUI\FieldLayout( $inputField, array( 'classes' => array( "mw-htmlform-field-$fieldType", $this->mClass, $errorClass ), 'align' => $this->getLabelAlignOOUI(), 'label' => $this->getLabel(), - 'help' => new OOUI\HtmlSnippet( $this->getHelpText() ), + 'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null, 'infusable' => $infusable, ) ); -- 2.20.1