From e75960fee33d5e54f3585d8c6f61bb8a50d3c4d4 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 18 Mar 2020 11:44:23 -0600 Subject: [PATCH] php 7.4 fixes for ParsedownExtra --- system/src/Grav/Framework/Parsedown/ParsedownExtra.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Parsedown/ParsedownExtra.php b/system/src/Grav/Framework/Parsedown/ParsedownExtra.php index 72b1c2488..821900576 100644 --- a/system/src/Grav/Framework/Parsedown/ParsedownExtra.php +++ b/system/src/Grav/Framework/Parsedown/ParsedownExtra.php @@ -212,7 +212,7 @@ class ParsedownExtra extends Parsedown { $Block = parent::blockHeader($Line); - if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) + if ($Block !== null && preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) { $attributeString = $matches[1][0]; @@ -244,7 +244,7 @@ class ParsedownExtra extends Parsedown { $Block = parent::blockSetextHeader($Line, $Block); - if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) + if ($Block !== null && preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) { $attributeString = $matches[1][0]; @@ -308,7 +308,7 @@ class ParsedownExtra extends Parsedown { $Link = parent::inlineLink($Excerpt); - $remainder = substr($Excerpt['text'], $Link['extent']); + $remainder = $Link !== null ? substr($Excerpt['text'], $Link['extent']) : ''; if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches)) {