1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Don't assume marker type is correct

This commit is contained in:
Aidan Woods 2019-01-27 16:54:04 +00:00
parent cbe7b25b21
commit 4563ee592d
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -56,7 +56,11 @@ final class Emphasis implements Inline
return null; return null;
} }
$marker = $Excerpt->text()[0] === '*' ? '*' : '_'; $marker = $Excerpt->text()[0];
if ($marker !== '*' && $marker !== '_') {
return null;
}
if ($Excerpt->text()[1] === $marker && \preg_match(self::$STRONG_REGEX[$marker], $Excerpt->text(), $matches)) { if ($Excerpt->text()[1] === $marker && \preg_match(self::$STRONG_REGEX[$marker], $Excerpt->text(), $matches)) {
$emphasis = 'strong'; $emphasis = 'strong';