Noticed this issue when adding a media pane, but was able to reproduce when adding HTML/links/maps/text etc, entering a title with an '&', and checking 'Make title a link.' When the pane displayed, the title was made a link successfully, but instead of displaying the '&', it displayed &. This is a non-issue if the 'Make title a link' checkbox is not checked, which led me to the following code in fieldable_panels_panes_preprocess_panels_pane in fieldable_panels_panes.module:

      if ($entity->link && !empty($vars['title'])) {
        $vars['title'] = l($vars['title'], $entity->path);
      }

The call to the l() function is sanitizing the title a second time via check_plain(), which leads to the escaped '&' displaying. To prevent this, I will be posting a patch shortly which bypasses the check_plain for the text by passing html->TRUE in the options array (see l() function for more detail - https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7).

Proposed change:

      if ($entity->link && !empty($vars['title'])) {
        $vars['title'] = l($vars['title'], $entity->path, array("html" => TRUE));
      }

The title is sanitized via a call to filter_xss_admin in fieldable_panels_panes_fieldable_panels_pane_content_type_render in fieldable_panels_pane.inc, so this should not be a security issue.

Comments

malik.kotob’s picture

patch for 7.x-1.x branch attached

malik.kotob’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: fieldable_panels_panes-special-chars-title-2508629-1.patch, failed testing.

malik.kotob’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs work » Needs review

damienmckenna’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This needs some tests to confirm that the titles work correctly.

Jacqs’s picture

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new3.06 KB

This adds a test.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.