Project

General

Profile

« Previous | Next » 

Revision cba2816e

Added by NOYB NOYB over 9 years ago

Form Group - Empty Title GetText

Don't call gettext with an empty title.

There are undoubtedly other places that a check should be done before passing a variable only to a gettext call.

Fixes use case of form group class without a title from passing empty var to gettext.
Gettext returns header info. when an empty string/var is passed.

Perhaps a function should be created for this for consistency.
http://php.net/manual/en/function.gettext.php#108594

For groups without a title gettext returns header info.

To reproduce the issue select a non English language and open any of the following:
Services Load Balancer - edit
Diagnostics - Backup/Restore
Diagnostics - Status SMART
Status - System Logs - log filter and manage log panels
(not a comprehensive list)

View differences:

src/usr/local/www/classes/Form/Group.class.php
148 148
		$label = new Form_Element('label', false, ['for' => $target]);
149 149
		$label->addClass('col-sm-'.Form::LABEL_WIDTH, 'control-label');
150 150

  
151
		$title = htmlspecialchars(gettext($this->_title));
151
		if (!empty(trim($this->_title)) || is_numeric($this->_title))
152
			$title = htmlspecialchars(gettext($this->_title));
152 153

  
153 154
		return <<<EOT
154 155
	{$element}

Also available in: Unified diff