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

Poll options preview rendered incorrectly by <br /> collision

    XMLWordPrintable

Details

    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.

      Attachments

        Activity

          People

            prototech prototech [X] (Inactive)
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: