$sValue = $this->getString($sName);
if ($sValue) {
- return explode(',', $sValue);
+ // removes all NULL, FALSE and Empty Strings but leaves 0 (zero) values
+ return array_values(array_filter(explode(',', $sValue), 'strlen'));
}
return $aDefault;
$this->assertSame('default', $oParams->getString('non-exists', 'default'));
$this->assertSame('abc', $oParams->getString('str1'));
$this->assertSame(false, $oParams->getStringList('str2'));
- $this->assertSame(false, $oParams->getStringList('str3')); // FIXME: should be 0 instead?
+ $this->assertSame(false, $oParams->getStringList('str3')); // sadly PHP magic treats 0 as false when returned
}
$this->assertSame(false, $oParams->getStringList('non-exists'));
$this->assertSame(['a', 'b'], $oParams->getStringList('non-exists', ['a', 'b']));
- // FIXME: unclear if empty string items should be removed
- $this->assertSame(['', 'a', 'b', 'c', '', 'c', 'd'], $oParams->getStringList('list1'));
+ $this->assertSame(['a', 'b', 'c', 'c', 'd'], $oParams->getStringList('list1'));
$this->assertSame(['a'], $oParams->getStringList('list2'));
$this->assertSame(false, $oParams->getStringList('list3'));
$this->assertSame(false, $oParams->getStringList('list4'));