Bugfix: Config used invalid gettype() values

This commit is contained in:
djmaze 2020-12-02 11:55:54 +01:00
parent 755fcf43b7
commit 2b8c259fe3
2 changed files with 67 additions and 70 deletions

View file

@ -74,21 +74,20 @@ abstract class AbstractConfig
{
if (isset($this->aData[$sSectionKey][$sParamKey][0]))
{
$sType = \gettype($this->aData[$sSectionKey][$sParamKey][0]);
switch ($sType)
switch (\gettype($this->aData[$sSectionKey][$sParamKey][0]))
{
default:
case 'float':
case 'string':
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
case 'boolean':
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
break;
case 'double':
$this->aData[$sSectionKey][$sParamKey][0] = (float) $mParamValue;
break;
case 'int':
case 'integer':
$this->aData[$sSectionKey][$sParamKey][0] = (int) $mParamValue;
break;
case 'bool':
case 'boolean':
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
case 'string':
default:
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
break;
}
}
@ -275,17 +274,16 @@ abstract class AbstractConfig
$sValue = '""';
switch (\gettype($mParamValue[0]))
{
default:
case 'string':
$sValue = '"'.\str_replace('"', '\"', $mParamValue[0]).'"';
case 'boolean':
$sValue = $mParamValue[0] ? 'On' : 'Off';
break;
case 'int':
case 'double':
case 'integer':
$sValue = $mParamValue[0];
break;
case 'bool':
case 'boolean':
$sValue = $mParamValue[0] ? 'On' : 'Off';
case 'string':
default:
$sValue = '"'.\str_replace('"', '\\"', $mParamValue[0]).'"';
break;
}

View file

@ -125,10 +125,9 @@ class Application extends \RainLoop\Config\AbstractConfig
'allow_additional_accounts' => array(true, ''),
'allow_additional_identities' => array(true, ''),
'messages_per_page' => array(20, ' Number of messages displayed on page by default'),
'messages_per_page' => array(20, 'Number of messages displayed on page by default'),
'attachment_size_limit' => array(25,
'File size limit (MB) for file upload on compose screen
'attachment_size_limit' => array(25, 'File size limit (MB) for file upload on compose screen
0 for unlimited.')
),