[ticket/16426] Ensure 0 is not added as an option

PHPBB3-16426
This commit is contained in:
mrgoldy 2020-05-02 23:43:22 +02:00
parent 9a72f39ff3
commit d9e07b3b29

View file

@ -1478,14 +1478,15 @@ if (!$s_forums)
/**
* Build options for a select list for the number of characters returned.
*
* If the admin defined amount is not available, we add that option.
* If the admin defined amount is not within the predefined range,
* and the admin did not set it to unlimited (0), we add that option aswell.
*
* @deprecated 3.3.1-RC1 Templates should use an numeric input, in favor of a select.
*/
$s_characters = '<option value="0">' . $user->lang('ALL_AVAILABLE') . '</option>';
$i_characters = array_merge([25, 50], range(100, 1000, 100));
if (!in_array((int) $config['default_search_return_chars'], $i_characters))
if ($config['default_search_return_chars'] && !in_array((int) $config['default_search_return_chars'], $i_characters))
{
$i_characters[] = (int) $config['default_search_return_chars'];
sort($i_characters);