Finally worked my way to the bottom of this issue after pulling my hair out with Panels for a day. CTools provides a function to strip all sidebar regions (which Panels calls using the Disable drupal blocks/regions setting).

Line 775 of ctools.module reads:
if (substr_compare($block->region, 'sidebar', 0)) {
unset($blocks($block_id));
}

This evaluates to true for all cases EXCEPT where the two strings are IDENTICAL. (substr_compare calls strcmp which is <0 for nonmatch, 0 for full match and >0 for partial match). 0 converts to FALSE, but -1 and +1 both convert to TRUE.

I have corrected the error by adding the explicit comparitor >=0 to read:
if (substr_compare($block->region, 'sidebar', 0)>=0) {
unset($blocks($block_id));
}

This now works as intended.
(This is my first debugging experience with PHP and I have no idea how to make a patch, and at 1am I have little desire to learn right now...) ;)

CommentFileSizeAuthor
#2 1137416-sidebar-compare-wonky.patch534 bytesmerlinofchaos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vflirt’s picture

I am afraid that this solution is not working. Checking for 'sidebar' region is wrong the way it is implemented.
Test case : substr_compare('sub_menu_region', 'sidebar', 0)
Obviously the sub_menu_region is not part of the sidebar but it will return "1".
What you should be checking is the position of the 'sidebar' string in the region name with maybe strpos as this is fast function and all you need to be carefull is to use === for checking the result as described in the function documentation.

merlinofchaos’s picture

Status: Active » Needs review
FileSize
534 bytes

Yeah, I think it probably should be strpos.

Does this patch do the trick for you?

merlinofchaos’s picture

Status: Needs review » Fixed

Committed.

vflirt’s picture

That is exactly what i have changed to make it work for me.

Status: Fixed » Closed (fixed)

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