Drop the 'NIL' checkes because the parser now properly handles NIL.

This prevents conflicts with real values named "NIL"
This commit is contained in:
djmaze 2021-11-04 16:38:08 +01:00
parent a6ebee8e13
commit d09f4cd14a
4 changed files with 11 additions and 15 deletions

View file

@ -456,7 +456,7 @@ class BodyStructure
} }
$sBodyMainType = null; $sBodyMainType = null;
if (\is_string($aBodyStructure[0]) && 'NIL' !== $aBodyStructure[0]) if (\is_string($aBodyStructure[0]))
{ {
$sBodyMainType = $aBodyStructure[0]; $sBodyMainType = $aBodyStructure[0];
} }
@ -520,7 +520,7 @@ class BodyStructure
if ($iExtraItemPos < \count($aBodyStructure)) if ($iExtraItemPos < \count($aBodyStructure))
{ {
if (!\is_string($aBodyStructure[$iExtraItemPos]) || 'NIL' === $aBodyStructure[$iExtraItemPos]) if (!\is_string($aBodyStructure[$iExtraItemPos]))
{ {
return null; return null;
} }
@ -549,7 +549,7 @@ class BodyStructure
} }
$sBodyMainType = \strtolower($sBodyMainType); $sBodyMainType = \strtolower($sBodyMainType);
if (!\is_string($aBodyStructure[1]) || 'NIL' === $aBodyStructure[1]) if (!\is_string($aBodyStructure[1]))
{ {
return null; return null;
} }
@ -568,7 +568,7 @@ class BodyStructure
$sName = self::decodeAttrParameter($aBodyParams, 'name', $sContentType); $sName = self::decodeAttrParameter($aBodyParams, 'name', $sContentType);
} }
if (null !== $aBodyStructure[3] && 'NIL' !== $aBodyStructure[3]) if (null !== $aBodyStructure[3])
{ {
if (!\is_string($aBodyStructure[3])) if (!\is_string($aBodyStructure[3]))
{ {
@ -578,7 +578,7 @@ class BodyStructure
$sContentID = $aBodyStructure[3]; $sContentID = $aBodyStructure[3];
} }
if (null !== $aBodyStructure[4] && 'NIL' !== $aBodyStructure[4]) if (null !== $aBodyStructure[4])
{ {
if (!\is_string($aBodyStructure[4])) if (!\is_string($aBodyStructure[4]))
{ {
@ -588,7 +588,7 @@ class BodyStructure
$sDescription = $aBodyStructure[4]; $sDescription = $aBodyStructure[4];
} }
if (null !== $aBodyStructure[5] && 'NIL' !== $aBodyStructure[5]) if (null !== $aBodyStructure[5])
{ {
if (!\is_string($aBodyStructure[5])) if (!\is_string($aBodyStructure[5]))
{ {
@ -671,7 +671,7 @@ class BodyStructure
{ {
if (null !== $aDispList[0]) if (null !== $aDispList[0])
{ {
if (\is_string($aDispList[0]) && 'NIL' !== $aDispList[0]) if (\is_string($aDispList[0]))
{ {
$sDisposition = $aDispList[0]; $sDisposition = $aDispList[0];
} }
@ -695,7 +695,7 @@ class BodyStructure
$sLanguage = null; $sLanguage = null;
if ($iExtraItemPos < \count($aBodyStructure)) if ($iExtraItemPos < \count($aBodyStructure))
{ {
if (null !== $aBodyStructure[$iExtraItemPos] && 'NIL' !== $aBodyStructure[$iExtraItemPos]) if (null !== $aBodyStructure[$iExtraItemPos])
{ {
if (\is_array($aBodyStructure[$iExtraItemPos])) if (\is_array($aBodyStructure[$iExtraItemPos]))
{ {
@ -712,7 +712,7 @@ class BodyStructure
$sLocation = null; $sLocation = null;
if ($iExtraItemPos < \count($aBodyStructure)) if ($iExtraItemPos < \count($aBodyStructure))
{ {
if (null !== $aBodyStructure[$iExtraItemPos] && 'NIL' !== $aBodyStructure[$iExtraItemPos]) if (null !== $aBodyStructure[$iExtraItemPos])
{ {
if (\is_string($aBodyStructure[$iExtraItemPos])) if (\is_string($aBodyStructure[$iExtraItemPos]))
{ {

View file

@ -201,7 +201,7 @@ class FetchResponse
*/ */
private static function findEnvelopeIndex(array $aEnvelope, int $iIndex, ?string $mNullResult) private static function findEnvelopeIndex(array $aEnvelope, int $iIndex, ?string $mNullResult)
{ {
return (isset($aEnvelope[$iIndex]) && 'NIL' !== $aEnvelope[$iIndex] && '' !== $aEnvelope[$iIndex]) return (isset($aEnvelope[$iIndex]) && '' !== $aEnvelope[$iIndex])
? $aEnvelope[$iIndex] : $mNullResult; ? $aEnvelope[$iIndex] : $mNullResult;
} }
} }

View file

@ -66,7 +66,6 @@ class Folder
public function setDelimiter(?string $sDelimiter) : void public function setDelimiter(?string $sDelimiter) : void
{ {
$sDelimiter = 'NIL' === \strtoupper($sDelimiter) ? null : $sDelimiter;
$this->sDelimiter = $sDelimiter; $this->sDelimiter = $sDelimiter;
if ($sDelimiter) { if ($sDelimiter) {
$aNames = \explode($this->sDelimiter, $this->sFullNameRaw); $aNames = \explode($this->sDelimiter, $this->sFullNameRaw);

View file

@ -99,10 +99,7 @@ class ResponseCollection extends \MailSo\Base\Collection
{ {
$c = \count($oResponse->ResponseList[3]); $c = \count($oResponse->ResponseList[3]);
for ($i = 0; $i < $c; $i += 2) { for ($i = 0; $i < $c; $i += 2) {
$value = $oResponse->ResponseList[3][$i+1]; $aReturn[$oResponse->ResponseList[3][$i]] = $oResponse->ResponseList[3][$i+1];
if ('NIL' !== $value) {
$aReturn[$oResponse->ResponseList[3][$i]] = $value;
}
} }
} }
} }