Line wrap RegEx bug
-
Hi,
There is a bug in the RegEx on line 1056 of the file
task.php:$l_str_FootnoteText = preg_replace( '#(?<![-\w\.!~\*\'\(\);]=[\'"])(?<![-\w\.!~\*\'\(\);]=)((ht|f)tps?://[^\\s<]+)#', '<span class="footnote_url_wrap">$1</span>', $l_str_FootnoteText );Expected Result
The RegEx should ‘line wrap…URLs (hyperlinked or not) based on pattern, not link element, to prevent them from hanging out of the tooltip in non-Unicode-compliant user agents.’
Actual Result
The footnote rendering completely breaks when using a URL with two
https://strings, e.g., a Web page saved via the Wayback Machine (likehttps://web.archive.org/web/20210122200554/https://wordpress.org/plugins/footnotes/).Steps to Replicate
See this RegExr example.
Also, here is a screenshot of the rendering issue—note that due to an apparently-unrelated numbering issue, the ordering of the second and third footnotes is switched.
This is the code that produced that (using the
((/))footnote tags):This is a normal, link-free footnote.((Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.)) This is a footnote with a link in it.((Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. <a href="https://wordpress.org/plugins/footnotes/" target="_blank" rel="noopener noreferrer">Perferendis blanditiis voluptatem</a> laudantium et ut ea illo veritatis.)) This is the same footnote with a Wayback Machine link in it.((Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. <a href="https://web.archive.org/web/20210122200554/https://wordpress.org/plugins/footnotes//" target="_blank" rel="noopener noreferrer">Perferendis blanditiis voluptatem</a> laudantium et ut ea illo veritatis.))Temporary Workaround
Disabling the ‘Allow URLs to line-wrap anywhere’ setting stops this from happening.
The topic ‘Line wrap RegEx bug’ is closed to new replies.