- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.7k
Open
Labels
Description
Steps to reproduce the issue
create a filter field like below that will NOT return a (in this case) item:
		<field
			name="created_by"
			type="sql"
			sql_select="a.id, a.created_by, u.id, u.name AS name"
			sql_from="#__example_clickedlinks AS a"
			sql_join="#__users AS u ON a.created_by = u.id"
			sql_group="a.created_by"
			sql_order="u.name ASC"
			key_field="created_by"
			value_field="name"
			onchange="this.form.submit();"
			>
			<option value="">COM_EXAMPLE_CLICKEDBY_FILTER</option>
		</field>
Expected result
empty filter without errors
Actual result
Deprecated: trim(): Passing null to parameter # 1 ($string) of type string is deprecated in /var/www/html/test/50/libraries/src/HTML/Helpers/Select.php on line 388
and
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/html/test/50/libraries/src/HTML/Helpers/Select.php on line 557
Additional comments
change line 388 in libraries/src/HTML/Helpers/Select.php from:
$obj->{$options['option.text']} = trim($text) ? $text : $value;
to
$obj->{$options['option.text']} = trim((string) $text) ? $text : $value;
change line 557 in libraries/src/HTML/Helpers/Select.php from:
$splitText = explode(' - ', $text, 2)
to
$splitText = explode(' - ', (string) $text, 2)