Searched the issues and couldn't find one for this.

Problem

When the page title is "Something & Something" the page title ends up being "Something & Something" when it should be "Something & Something".

Steps to reproduce.
1. New Drupal 7.14 install
2. Install QuickTabs 7.x-3.4
3. Create 2 new pages one with an &, ("Something & Something") in the page title and a second for the tab callback.
3. Create a new QuickTab instance with the Tab Type as callback and assign nid (i.e. node/3) of the page created above.
4. Assign the QT block to a region.
5. Visit page with the & in the title and shows the QT in the region.

Expected result: Page title of "Something & Something"

Actual result: Page title of "Something & Something"

An extra amp; is added for every tab. The code this is happening in is quicktabs/plugins/QuickCallbackContent.inc in the render function.

Comments

kamkejj’s picture

Issue summary: View changes

Title is actually Something & Something not Something & Something. The extra amp; is breaking the title.

kamkejj’s picture

The title actually is showing "Something & Something" with an extra amp;

kamkejj’s picture

Issue summary: View changes

Added code tags to show Something & Something with the extra amp;

kamkejj’s picture

Maybe an issue for core. The checkplain($text) function in bootstrap.inc returns htmlspecialchars without the fourth parameter for double_encode which defaults to true. For every tab drupal_get_title and drupal_set_title is called (plugins/QuickCallbackContent.inc line 64 and 67) for the same title and because the double_encode defaults to true the & in for example & is encoded again as &.

Solution:

1. Call drupal_get_title and drupal_set_title only once in plugins/QuickCallbackContent.inc in the render function

or

2. Add the 4th parameter to htmlspecialchars in check_plain of FALSE to prevent double encoding.

blc’s picture

I can confirm that setting the 4th parameter of htmlspecialchars in check_plain to false fixes this problem for me. I'm not sure what side effects that might have elsewhere, though.

kamkejj’s picture

StatusFileSize
new3.43 KB

I tried posting here http://drupal.org/node/1630468 about check_plain() and didn't get any where.

A fix might be to simply use the PASS_THROUGH in drupal_set_title($page_title, PASS_THROUGH) skipping check_plain. This should be fine since the page title still gets run through check_plain at least once.

Here's a patch that adds PASS_THROUGH.

kamkejj’s picture

Status: Active » Needs review

Setting as needs review.

avr’s picture

Status: Needs review » Reviewed & tested by the community

I ran into this same issue and can confirm this patch works and should be safe.

avr’s picture

Issue summary: View changes

Additional info

Anticosti’s picture

Issue summary: View changes

Patch applied on 7.36: Works for me.
Should go in next release -;
Thanks :)

netw3rker’s picture

Version: 7.x-3.4 » 7.x-3.x-dev

I'll take this patch, but it is currently using the wrong line-endings. When that is updated, it'll go in. Thanks for all the work everyone!

netw3rker’s picture

Status: Reviewed & tested by the community » Needs work
vbouchet’s picture

Status: Needs work » Needs review
StatusFileSize
new513 bytes

Hi,

I ran into this issue and applied the patch to fix the issue. Please find an updated patch which should use the appropriate line-ending so it can be added to the next release.

  • smustgrave committed afd13540 on 7.x-3.x
    Issue #1627744 by kamkejj, vbouchet, avr, netw3rker, blc, Anticosti:...
smustgrave’s picture

Status: Needs review » Fixed

Will include in one of the last releases of D7 quicktabs.

smustgrave’s picture

Status: Fixed » Closed (fixed)
smustgrave’s picture