After Redis was enabled, noticed that some pages were returning blank on first load. The nginx logs noted this error:
[error] FastCGI sent in stderr: "PHP message: PHP Fatal error: Unsupported operand types in /sites/all/modules/panelizer/plugins/task_handlers/panelizer_node.inc on line 311" while reading response header from upstream
Did some investigation, and saw the code around line 311 is running twice when cache is cleared, and logged this result in watchdog:
panelizer $panel_body_css = Array ( )
panelizer $info[classes_array] = Array ( [0] => node-unpublished )
panelizer $panel_body_css =
panelizer $info[classes_array] = Array ( [0] => node-unpublished )
On the second execution $panel_body_css
is not an array, which throws the error message for line 311.
The root cause of this is how Panels handles the same $panel_body_css
variable. In both panels_preprocess_html
and panels_panel_context_render
, the call is defined as follows:
$panel_body_css = &drupal_static('panel_body_css');
The problem is Panels has not defined a default array()
if panel_body_css
is empty, while Panelizer depends on it.
Putting an is_array
around line 311 in panelizer_node.inc
solves the problem, but maybe you feel the patch should be on Panels to add a default array()
? I'm not sure this variable *should* be forced to be an array, or is more of an specific need set by Panelizer.
Also I'm not entirely sure why line 311 even exists... it merges an empty value for the key body_classes_to_add
into $panel_body_css
, only to have it completely reset on the very next line.
Patch is attached for review, thanks.
Comment | File | Size | Author |
---|---|---|---|
#4 | panels-unsupported_operand_type-2985814-4.patch | 1.69 KB | ron_s |
Comments
Comment #2
ron_s CreditAttribution: ron_s commentedComment #3
DamienMcKennaI completely agree with your suggestion that this should be in Panels and that "panel_body_css" should be an array by default, instead of NULL.
Comment #4
ron_s CreditAttribution: ron_s commentedOk, here's a patch that sets default values to
array()
in Panels. See attached.Comment #5
ron_s CreditAttribution: ron_s commentedThis patch still works in the latest 7.x-3.10 release. Please review, thanks.
Comment #6
joelpittetThanks again @ron_s, I've committed this to the dev branch.
Comment #9
joelpittetAdding to release plan #3157069: Plan for Panels 7.x-3.11