Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-16512

make_clickable() function does not apply custom classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.2-RC1
    • 3.3.0, 3.2.10-RC1
    • Posting, Viewing posts
    • None

      If a serial call is being made like{{}}

      make_clickable('http://localhost/phpBB3/index.php', false, 'class1'); make_clickable('http://localhost/phpBB3/index.php', false, 'class2'); make_clickable('http://localhost/phpBB3/index.php', false, 'class3');

      {{}}you'll always get the same result as with the 1st call 

      <!-- l --><a class="class1-local" href="http://localhost/331/index.php">index.php</a><!-- l -->

       
      The cause is that static array $magic_url_match_args is just got appended with every call so preg_replace_callback()}}applies the 1st suitable regex which is always {{class1 related.
       
      Also if one more call with email got appended, f.e. {{}}

      make_clickable('test@email.com', false, 'class4'); 

      the result will be multiplied by all make_clickable() calls, like 

      <!-- e --><a href="mailto:test@email.com"><!-- e --><a href="mailto:test@email.com"><!-- e --><a href="mailto:test@email.com"><!-- e --><a href="mailto:test@email.com">test@email.com</a><!-- e --></a><!-- e --></a><!-- e --></a><!-- e -->

            Marc Marc
            rxu rxu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: