Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/16034] Fix [url=] links being incorrectly shortened #5577

Merged
merged 1 commit into from May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions phpBB/phpbb/textformatter/s9e/link_helper.php
Expand Up @@ -60,8 +60,10 @@ public function generate_link_text_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\
$length = $end - $start;
$text = substr($parser->getText(), $start, $length);

// Create a tag that consumes the link's text
$parser->addSelfClosingTag('LINK_TEXT', $start, $length)->setAttribute('text', $text);
// Create a tag that consumes the link's text and make it depends on this tag
$link_text_tag = $parser->addSelfClosingTag('LINK_TEXT', $start, $length);
$link_text_tag->setAttribute('text', $text);
$tag->cascadeInvalidationTo($link_text_tag);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/text_formatter/s9e/default_formatting_test.php
Expand Up @@ -253,6 +253,10 @@ public function get_default_formatting_tests()
'[url=http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[/url]',
'<a href="http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" class="postlink">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</a>'
),
array(
'[url=http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[/url]',
'<a href="http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" class="postlink">http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</a>'
),
array(
'[quote="[url=http://example.org]xxx[/url]"]...[/quote]',
'<blockquote><div><cite><a href="http://example.org" class="postlink">xxx</a> wrote:</cite>...</div></blockquote>'
Expand Down