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

Wrong parameter for preg_replace() function.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 3.0.3
    • 3.0.x
    • Search
    • None
    • PHP Environment: 5.3.0a1
      Database:

      Yeah, this bug exists in phpBB 3.x for a long time, but actually it appears only when running under PHP 5.3.x and newer one.

      includes/functions_content.php (get_context() function, line 240)

          // first replace all whitespaces with single spaces    $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", '     '), $text); 

      should be:

          // first replace all whitespaces with single spaces    $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", '     '), utf8_strlen($text)); 

      AFAIK PHP 5.3 has more restrictive functions parameters mechanism, that's why previous PHP versions have never reported about the fact, that a string instead of a long is passed to the function. This issue also makes the text of a post not display in search results, when running under PHP 5.3.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            faw faw
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: