From dbb995733de199f71360cfc4bd18b2dd29d2d6fc Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Tue, 17 Jun 2025 16:32:56 -0700 Subject: [PATCH] Cast attr to string to prevent a PHP deprecation warning in 8.1 (#365) * Cast attr to string to prevent a PHP deprecation warning in 8.1 * Update the call to preg_match_all to coalesce an empty string on $attr --- Michelf/MarkdownExtra.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php index f814cde..c27183d 100644 --- a/Michelf/MarkdownExtra.php +++ b/Michelf/MarkdownExtra.php @@ -229,7 +229,7 @@ class MarkdownExtra extends \Michelf\Markdown { } // Split on components - preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr, $matches); + preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr ?? '', $matches); $elements = $matches[0]; // Handle classes and IDs (only first ID taken into account)