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

Poll options preview rendered incorrectly by <br /> collision

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.0.13
    • Fix Version/s: 3.0.14-RC1, 3.1.4-RC1, 3.2.0-a1
    • Component/s: Posting
    • Labels:
      None
    • Environment:
      PHP 5.4.7

      Description

      1. Create a custom BBCode (i.e. [br][/br]) that renders to <br />
      2. Create/edit one poll option using that BBCode
      3. Preview the poll (with its option)
      You'll see it renders as two options instead of one option. The culprit is in \posting.php:

      $parse_poll->message = implode("\n", $post_data['poll_options']);
      $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);
      $preview_poll_options = explode('<br />', $parse_poll->message);

      The last line wrongly assumes <br /> is a unique translation of "\n", but that is not true anymore once a BBCode translates to <br /> aswell, leading to cut one poll option into multiple.

      A more than obvious fix is to parse each poll option on it's own by simply replacing the code above with:

      $preview_poll_options= array();
      foreach( $post_data['poll_options'] as $iPollOption=> $sPollOption ) {
      	$parse_poll-> message= $sPollOption;
      	$parse_poll-> format_display( $post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'] );
      	$preview_poll_options[$iPollOption]= $parse_poll-> message;
      }

      Tested successfully.

        Activity

        Hide
        AmigoJack AmigoJack added a comment -

        Why is no fix considered for a 3.0 maintenance release?

        Show
        AmigoJack AmigoJack added a comment - Why is no fix considered for a 3.0 maintenance release?

          People

          • Assignee:
            prototech prototech
            Reporter:
            AmigoJack AmigoJack
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development