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
This commit is contained in:
Kevin Boyd 2025-06-17 16:32:56 -07:00 committed by GitHub
parent 51613168d7
commit dbb995733d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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