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...) ;)
Comment | File | Size | Author |
---|---|---|---|
#2 | 1137416-sidebar-compare-wonky.patch | 534 bytes | merlinofchaos |
Comments
Comment #1
vflirt CreditAttribution: vflirt commentedI 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.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedYeah, I think it probably should be strpos.
Does this patch do the trick for you?
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted.
Comment #4
vflirt CreditAttribution: vflirt commentedThat is exactly what i have changed to make it work for me.