Skip to content

Commit

Permalink
Avoid array access on null error in php 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 11, 2020
1 parent 7ee962e commit 4a8e248
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Horde/ActiveSync/Message/Base.php
Expand Up @@ -345,7 +345,7 @@ public function decodeStream(Horde_ActiveSync_Wbxml_Decoder &$decoder)
// Get next element and sanity check the type. We MUST have a
// STARTTAG here, or it's time to break out.
$entity = $decoder->getElement();
if ($entity[Horde_ActiveSync_Wbxml::EN_TYPE] == Horde_ActiveSync_Wbxml::EN_TYPE_ENDTAG) {
if (empty($entity) || $entity[Horde_ActiveSync_Wbxml::EN_TYPE] == Horde_ActiveSync_Wbxml::EN_TYPE_ENDTAG) {
$decoder->_ungetElement($entity);
break;
}
Expand Down
9 changes: 7 additions & 2 deletions lib/Horde/ActiveSync/Wbxml/Decoder.php
Expand Up @@ -139,7 +139,9 @@ public function getFullInputStream()
public function getElement()
{
$element = $this->getToken();

if (empty($element)) {
return false;
}
switch ($element[self::EN_TYPE]) {
case self::EN_TYPE_STARTTAG:
return $element;
Expand Down Expand Up @@ -282,7 +284,10 @@ public function getToken()
}

$el = $this->_getToken();
$this->_logToken($el);

if (!empty($el)) {
$this->_logToken($el);
}

return $el;
}
Expand Down

0 comments on commit 4a8e248

Please sign in to comment.