Skip to content

AutolinkExtension incorrectly identifies a link if the text contains www. #1095

@Serpanok

Description

@Serpanok

Version(s) affected

2.7.1

Description

If the text contains www. and then a link, it is incorrectly replaced by deleting www. and the part of the text after it. Also, part of the text is cut out and not the entire link is determined.

How to reproduce

Example:

$text = 'test text www. test https://commonmark.thephpleague.com/2.7/extensions/autolinks/ more text';

$Environment = new Environment();
$Environment->addExtension(new CommonMarkCoreExtension());
$Environment->addExtension(new AutolinkExtension());
$MarkdownConverter = new MarkdownConverter($Environment);
echo $MarkdownConverter->convert($text);

Output:
<p>test text <a href="https://commonmark.thephpleague.com/2.7/extensions/autolinks/">https://commonmark.thephpleague.com/2.7/extensions/autolinks/</a>autolinks/ more text</p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions