1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Fixes #4609 - Quick fix for inconsistent drop-down behavior PHP7 -> PHP8.

This commit is contained in:
Cameron
2021-11-01 14:41:40 -07:00
parent c3036f975c
commit 7930aba4ca
2 changed files with 9 additions and 3 deletions

View File

@@ -3487,6 +3487,12 @@ var_dump($select_options);*/
$opts = $options; $opts = $options;
if($selected === array(0=>'')) // quick fix. @see github issue #4609
{
$selected = 0;
}
foreach ((array) $option_array as $value => $label) foreach ((array) $option_array as $value => $label)
{ {
@@ -6740,7 +6746,7 @@ var_dump($select_options);*/
$eloptions['multiple'] = true; $eloptions['multiple'] = true;
} }
unset($parms['__options']); unset($parms['__options']);
if(!empty($eloptions['multiple']) && !is_array($value)) if(!empty($eloptions['multiple']) && !is_array($value) && !empty($value))
{ {
$value = explode(',', $value); $value = explode(',', $value);
} }

View File

@@ -790,11 +790,11 @@ class e_formTest extends \Codeception\Test\Unit
); );
foreach($tests as $row) foreach($tests as $index => $row)
{ {
$actual = $this->_frm->option_multi($row['options'],$row['value']); $actual = $this->_frm->option_multi($row['options'],$row['value']);
$actual = str_replace("\n", '', $actual); $actual = str_replace("\n", '', $actual);
$this->assertSame($row['expected'], $actual); $this->assertSame($row['expected'], $actual, 'Test #'.$index.' failed');
} }
} }