Whoops… my post above was a bit premature; it seems that there are more lines needing similar fixes:
line 1140:
$token_stack[0] = str_repeat($token{0}, 3-$token_len);
to
$token_stack[0] = str_repeat($token[0], 3-$token_len);
line 1165:
$em = $token{0};
to
$em = $token[0];
lines 1530-1532:
switch ($token{0}) {
case "\\":
return $this->hashPart("&#". ord($token{1}). ";");
to
switch ($token[0]) {
case "\\":
return $this->hashPart("&#". ord($token[1]). ";");
Also, the file /wp-readme-parser/includes/Michelf/MarkdownExtra.php
requires some additional changes in a similar vein:
line 163:
if ($element{0} == '.') {
to
if ($element[0] == '.') {
line 165:
} else if ($element{0} == '#') {
to
} else if ($element[0] == '#') {
line 434:
else if ($tag{0} == "\n" || $tag{0} == " ") {
to
else if ($tag{0} == "\n" || $tag{0} == " ") {
line 443:
else if ($tag{0} == "
“) {`
to
else if ($tag[0] == "
“) {`
line 481:
$tag{1} == '!' || $tag{1} == '?')
to
$tag[1] == '!' || $tag[1] == '?')
lines 500-501:
if ($tag{1} == '/') $depth--;
else if ($tag{strlen($tag)-2} != '/') $depth++;
to
if ($tag[1] == '/') $depth--;
else if ($tag[strlen($tag)-2] != '/') $depth++;
line 605:
return array($original_text{0}, substr($original_text, 1));
to
return array($original_text[0], substr($original_text, 1));
line 617:
$tag{1} == '!' || $tag{1} == '?')
to
$tag[1] == '!' || $tag[1] == '?')
lines 628-629:
if ($tag{1} == '/') $depth--;
else if ($tag{strlen($tag)-2} != '/') $depth++;
to
if ($tag{1} == '/') $depth--;
else if ($tag{strlen($tag)-2} != '/') $depth++;
line 993:
$level = $matches[3]{0} == '=' ? 1 : 2;
to
$level = $matches[3][0] == '=' ? 1 : 2;
line 1337:
if ($classname{0} == '.')
to
if ($classname[0] == '.')
If I find a few more of those, I’ll post them here as well!
Note that these files come from the PHP Markdown library; this plugin still uses version 1.6.0 of that library, which is far too old; the current version (as of writing) is 1.9.X, which already has all the above changes made, and, of course, adds a lot of bug fixes and extra features. Maybe the next version of Plugin README Parser can be shipped with a more recent version of PHP-Markdown?
Last but not least: aye, I’m aware that PHP 8.0 is ‘brand new’ for many, but remember that the current code will throw deprecation warnings on PHP 7.4, so it’s also a nice idea to get rid of those…