From: Bartosz DziewoƄski Date: Thu, 16 Jul 2015 18:59:11 +0000 (+0200) Subject: OOUIHTMLForm: Make sure arguments to OOUI\HtmlSnippet are really strings X-Git-Tag: 1.31.0-rc.0~10747 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=c61a678e9ca15f78f67ff9a83ee38bb0794037cb;p=lhc%2Fweb%2Fwiklou.git 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 --- 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, ) );