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.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | quicktabs-page-title-fix-1627744-10.patch | 513 bytes | vbouchet |
| #4 | quicktabs-page-title-fix-1627744-4.patch | 3.43 KB | kamkejj |
Comments
Comment #0.0
kamkejj commentedTitle is actually Something & Something not Something & Something. The extra amp; is breaking the title.
Comment #1
kamkejj commentedThe title actually is showing "
Something & Something" with an extra amp;Comment #1.0
kamkejj commentedAdded code tags to show Something & Something with the extra amp;
Comment #2
kamkejj commentedMaybe 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.
Comment #3
blc commentedI 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.
Comment #4
kamkejj commentedI 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.
Comment #5
kamkejj commentedSetting as needs review.
Comment #6
avr commentedI ran into this same issue and can confirm this patch works and should be safe.
Comment #6.0
avr commentedAdditional info
Comment #7
Anticosti commentedPatch applied on 7.36: Works for me.
Should go in next release -;
Thanks :)
Comment #8
netw3rker commentedI'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!
Comment #9
netw3rker commentedComment #10
vbouchetHi,
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.
Comment #12
smustgrave commentedWill include in one of the last releases of D7 quicktabs.
Comment #13
smustgrave commentedComment #14
smustgrave commented