From 73842d65be2b6cdb24fd592b765564c6ef1f6abd Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 14 Sep 2022 22:28:30 +0900 Subject: [PATCH] preg_split returning false will cause TypeError on invalid countable in PHP 8 --- Michelf/MarkdownExtra.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php index 796949e..548269f 100644 --- a/Michelf/MarkdownExtra.php +++ b/Michelf/MarkdownExtra.php @@ -683,7 +683,7 @@ class MarkdownExtra extends \Michelf\Markdown { // by the pattern. $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE); - if (count($parts) < 3) { + if ($parts === false || count($parts) < 3) { // End of $text reached with unbalenced tag(s). // In that case, we return original text unchanged and pass the // first character as filtered to prevent an infinite loop in the