Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9957

[url=...]Text \n with linebreak[/url] won't be recognized

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.0.7-PL1, 3.0.8
    • Fix Version/s: None
    • Component/s: Posting, Viewing posts
    • Labels:
      None
    • Environment:
      PHP 5.3.1, MySQL 5.1.41, Opera 11 / Firefox 3.0.5

      Description

      When using the extended [url=] BBCode to also use custom content for the link it is not possible to have linebreaks in it. The following usages will never validate:

      [url=http://www.phpbb.com]Check out
      phpBB 3.0.8![/url]
      [url=http://www.phpbb.com][img]http://www.phpbb.com/theme/images/logo_phpbb.png[/img]
      Check out phpBB![/url]

      This is because in /includes/message_parser.php, function bbcode_init() we have:

      		$this->bbcodes = array(
      ...
      			'url'			=> array('bbcode_id' => 3,	'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),

      ...whereas the match pattern misses linebreaks.

      I have two possible workarounds:

      1. adding the s modifier (but this will in first place also allow URLs with linebreaks):
        			'url'			=> array('bbcode_id' => 3,	'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#isUe' => "\$this->validate_url('\$2', '\$3')")),
      2. or indirectly allowing linebreaks by not allowing a character which should never occur (NUL):
        			'url'			=> array('bbcode_id' => 3,	'regexp' => array('#\[url(=(.*))?\]([^\x00]*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nickvergessen Joas Schilling
                Reporter:
                AmigoJack AmigoJack
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: