preg_split returning false will cause TypeError on invalid countable in PHP 8

This commit is contained in:
Alexey Kopytko 2022-09-14 22:28:30 +09:00 committed by GitHub
parent 546b80a136
commit 73842d65be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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