michelf / php-markdown

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.
http://michelf.ca/projects/php-markdown/
Other
3.42k stars 530 forks source link

Cast attr to string to prevent a PHP deprecation warning in 8.1 #365

Open beryllium opened 2 years ago

beryllium commented 2 years ago

I received this Deprecation notice when running unit tests for sculpin under PHP 8.1:

PHP Deprecated:  preg_match_all():
  Passing null to parameter #2 ($subject) of type string is deprecated
  in sculpin/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php
  on line 252

I solved it in the leanest way possible, which was to cast $attr to string. Let me know if you would prefer a different solution.

And thanks for building this library! I've been quite happy with it.