Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-217 now.

Multiline [url] not Converted (new)

When using a [ url ] BBCode tag whose text content spans multiple lines, the regex will not match and convert to markup accordingly.

Please refer to this test post in the development forums for an example.

Comments / History

Linked ticket with changeset: r3580

Action performed by Anonymous (I am too lazy to register) on Feb 28th 2003, 16:39

Posted by cheater512 on Mar 25th 2006, 05:55

Would a simple m after the preg delimiter fix it?
Might be a bit slower though.

Posted by curtisj on Mar 25th 2006, 08:03

Well, the "s" modifier is suited for such regex matching, and I haven't taken a look at the source code yet. I'm not a regular when it comes to phpBB source code, and happened upon it by accident. If the s modifier isn't already in use for the [url] regex pattern match, then that's probably all it would take to fix it.

Posted by Acyd Burn (Server Manager) on Mar 25th 2006, 09:02

This is not a bug. Newlines are not allowed in urls (or do you have seen them in urls recently?).

Posted by Clodo on Jun 11th 2009, 10:40

The patch:
Open "includes/message_parser.php"
Find
Code: Select all
array('#\[url(=(.*))?\](.*)\[/url\]#iUe'

Add the 's':
Code: Select all
array('#\[url(=(.*))?\](.*)\[/url\]#iUes'
.

------------
Can i ask why can't be fixed?
Multiline urls are allowed in html, are allowed in ALL board engine i test (Invision, vBulletin, SMF for example).
I'm developing tools that generate bbcodes... ok that doesn't exists an official standard, but exists some "agreement" that are respected by all board, except phpBB. This issue is one of them.
I'm only want to understand why, thanks.

Assigned ticket to user "Acyd Burn"

Action performed by bantu (3.0 Release Manager) on Jun 11th 2009, 11:16

Posted by curtisj on Jun 12th 2009, 03:38

I think there may have been a misunderstanding when I initially posted this.

I wasn't pointing out that line terminators should be allowed within the actual URI, but within the textual data that's displayed:

[url=http://www.phpbb.com/]phpBB
forums[/url]

Currently, the above BBCode will not be parsed at all. Even if the devs would prefer it doesn't actually insert line breaks, it may be helpful to some users if the BBCode parser at least parse the tag, converting the line breaks into spaces. Most, if not all, user agents will parse this just fine:

<a href="http://www.phpbb.com/">phpBB
forums</a>

A patched regex pattern should not apply the /s modifier to the whole pattern, but only the group matching the text between the tags. It would make life easier to start using the /x modifier, too. It's a lot easier to maintain complex regex patterns.

Open "includes/message_parser.php"
Find
Code: Select all
         'url'         => array('bbcode_id' => 3,   'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),

In-line Find
Code: Select all
'#\[url(=(.*))?\](.*)\[/url\]#iUe'

In-line replace:
Code: Select all
'#\[url(=(.*))?\]((?s).*)\[/url\]#iUe'


Just a note: the BBCode parser will, in fact, convert users' line breaks to <br> tags.

Posted by Clodo on Jun 12th 2009, 12:40

I quote curtisj.
Not also multiline url are allowed by html standard, but also Invision, vBulletin, SMF, in general all forum board engine i tested support multiline url.
Invision doesn't support in 1.x release, but was fixed at least in 2.x.

In my specific case, i have a tools that convert news from html to bbcode format, and multiline url are frequently used; for example, different thumbnail images, separated every X image, for creating a grid of screenshots; all surrounded by unique url to a complete gallery.
What i need to do, repeat the URL tag every line?

Honestly, if all the board engine, and also HTML, allow multiline url, this issue in phpBB must be a bug, imho. Secondly, if you don't want to fix, the ticket status "Will not fix" may be more correct.

Posted by Acyd Burn (Server Manager) on Jun 12th 2009, 14:48

To put it in the correct context - we won't allow URL's to span over multiple lines (obviously, because this is not allowed), regarding the explanation, text within the a tags - this is another story. We currently discuss this.

Changed ticket status from "Not a bug" to "Awaiting team input"

Action performed by Acyd Burn (Server Manager) on Jun 12th 2009, 14:49

Posted by suitlocal on Jun 12th 2009, 14:50

@Clodo - if it is by design it is by definition "not a bug". may be it is not a good design decision but from what has been said here it is by design all the same and hence "not a bug".

do yourself a favor and get a dictionary.

Edited post #161685

Action performed by suitlocal on Jun 12th 2009, 14:50

Ticket details

Related SVN changesets