Bugfix: Trying to access array offset on value of type null

Now that the ResponseParser is fixed and handles NIL the BodyStructure class bug was detected
This commit is contained in:
djmaze 2021-11-04 16:27:08 +01:00
parent 40b8bf3d7e
commit a6ebee8e13

View file

@ -680,20 +680,20 @@ class BodyStructure
return null;
}
}
}
$aDispParamList = $aDispList[1];
if (\is_array($aDispParamList))
{
$aDispositionParams = self::getKeyValueListFromArrayList($aDispParamList);
$sFileName = self::decodeAttrParameter($aDispositionParams, 'filename', $sCharset ?: '');
$aDispParamList = $aDispList[1];
if (\is_array($aDispParamList))
{
$aDispositionParams = self::getKeyValueListFromArrayList($aDispParamList);
$sFileName = self::decodeAttrParameter($aDispositionParams, 'filename', $sCharset ?: '');
}
}
}
++$iExtraItemPos;
$sLanguage = null;
if ($iExtraItemPos < count($aBodyStructure))
if ($iExtraItemPos < \count($aBodyStructure))
{
if (null !== $aBodyStructure[$iExtraItemPos] && 'NIL' !== $aBodyStructure[$iExtraItemPos])
{
@ -778,9 +778,10 @@ class BodyStructure
private static function getKeyValueListFromArrayList(array $aList) : array
{
$aDict = array();
if (0 === \count($aList) % 2)
$iLen = \count($aList);
if (0 === ($iLen % 2))
{
for ($iIndex = 0, $iLen = \count($aList); $iIndex < $iLen; $iIndex += 2)
for ($iIndex = 0; $iIndex < $iLen; $iIndex += 2)
{
if (\is_string($aList[$iIndex]) && isset($aList[$iIndex + 1]) && \is_string($aList[$iIndex + 1]))
{