Fatal error for mini panels layout settings
bangpound - May 26, 2008 - 19:34
| Project: | Panels |
| Version: | 5.x-2.0-beta4b |
| Component: | Mini panels |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Whenever I try to edit a mini panel's layout settings, I get a fatal error:
Fatal error: Unsupported operand types in /home/members/icirr/sites/icirr.org/web/sites/icirr.org/modules/panels/includes/display_edit.inc on line 517I suspected it was related to migrating from BETA3 to BETA4A, but when i create an entirely new Mini Panel, i still get the error.

#1
I hit the same problem in a different context. No expert at php or drupal, I eventually looked at the code at line 517.
I replaced:
$form += panels_panel_settings($display);with
$form = panels_panel_settings($display);This solved my problem, but it would be good to have an expert confirmation. I am using panels-5.x-2.0-beta4b.tar.gz dated 26 May 2008.
Excellent module, thank you!
#2
Had the exact same issue tonight with mini panels and page panels and this fix worked for me as well.
I fear the += had meaning.
Thanks
#3
Yes, I am afraid it does remove the error, but does not provide a solution. The change strips away all the good form preparation work up to that point in the function.
#4
This seems to have to do with
$layout['settings form']being empty for certain layouts, so $form is empty in line #517.It seems to me that as a workaround you can use the flexible layout for your mini panels for the time being, as for the flexible layout
$layout['settings form']is set.#5
The += is crucial, and it exists in prior betas of Panels 2.
I'm also getting the error on panel pages now, too.
#6
This has become a show-stopping critical bug for me, and I have to revert to BETA3. I can no longer edit the layout settings on any panel.
#7
Further confirming this bug and escalating the priority to critical, since the only way to restore panels functionality is to revert back to BETA3.
To clarify, this bug affects the 'Layout settings' of any mini panel not using 'Flexible' layout. Clicking 'Layout settings' triggers the above mentioned PHP Fatal Error. Panels 5.x-2.0-beta4b
#8
I'm pretty sure that the issue here is that the += operator is being fed operand data that php cannot calculate type switching for in such a way that it resolves without error. Could someone who's experiencing this error try changing the first few lines of the function from:
<?phpfunction panels_edit_layout_settings_form($display, $finish, $destination, $title) {
$layout = panels_get_layout($display->layout);
if (!empty($layout['settings form']) && function_exists($layout['settings form'])) { // TODO doc the ability to do this as part of the API
$form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
$form['layout_settings']['#tree'] = TRUE;
}
?>
and initialize the $form variable by changing it to:
<?phpfunction panels_edit_layout_settings_form($display, $finish, $destination, $title) {
$layout = panels_get_layout($display->layout);
$form = array();
if (!empty($layout['settings form']) && function_exists($layout['settings form'])) { // TODO doc the ability to do this as part of the API
$form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
$form['layout_settings']['#tree'] = TRUE;
}
?>
and see if that resolves the problem? If so, I'll patch in the fix immediately.
#9
the fatal error disappears after making the change suggested by sdboyer in #8. Thanks! I am proceeding with BETA4 again.
#10
I confirmed that this is the cause of the error, and have changed that function to suit. Changes are committed, and once I've dealt with the other small slew of incoming bugs, I'll either post beta4c or just beta5.
#11
Thanks, I was about to post a patch for this, too. ;)
#12
Just a note - I tried this fix today (per post #8 above) and it worked.
Thanks!
#13
I applied this fix a couple of days ago and have found another scenario where it does not work. I'm transferring posts #16 (as reference), 17, 18 and 19 of this thread -- http://drupal.org/node/263845#comment-863549 -- to here, since the disappearing panel and fatal error are really two separate issues.
#14
I did a grep in the panels directory and cannot find this function.
Please let me know where it is.
i am running beta4b
Chris
NEVERMIND FOUND IT....
#15
Sorry, but the bug of the original issue has been fixed.
Please check the issue queue for already existing issues that might be related to what you're experiencing. If there's not yet an issue, feel free to create a new one, please.
#16
Huh? No, the original issue was not entirely fixed. That's why I posted the information I did. I found a different Layout Settings scenario that was causing the exact same fatal error, even with the
$form = array();line added. If you would prefer this as a new issue, fine ... six in one, half-dozen in another. Makes no difference to me.#17
Works for me with $form = array();
#18
Ok ... works for you with $form = array() ... are you using Advanced Profile module?
#19
Point of order, re: #16 - there is no possible way for it to have been
, because the cause of the original error was an uninitialized variable (
$form), which becomes NULL, being used as the first operand in an operation that requires both of its arguments be arrays. Though the error text may be the same, that doesn't mean that the ERROR is the same - there are multiple operands in that operation, and because we absolutely know that the first variable is acceptable, then it must be a problem with the second variable. sun's point is technically accurate.Therein, however, lies another problem. I can't picture a scenario in which panels_panel_settings() could NOT return an array. It seems to me like the problem is either a) some screwy data that's getting chucked in in panels_panel_settings(), b) that the += operator doesn't handle key namespace clashes gracefully, or c) that there's some REALLY squirrely thing happening when the two get combined, which would basically mean that we've uncovered an error in php.
ron_s, if you could do me a favor - substitute and test each of the following code fragments for
$form += panels_panel_settings($display);; also ensure, to the best of your ability, that if it works, it is also outputting all the RIGHT stuff (that is, the same stuff as it did in beta3):<?php
// fragment 1
$form = $form + panels_panel_settings($display);
// fragment 2
$form = array_merge($form, panels_panel_settings($display));
// fragment 3
$form_additions = panels_panel_settings($display);
$form += $form_additions;
// fragment 4
$form_additions = panels_panel_settings($display);
$form = $form + $form_additions;
// fragment 5
$form_additions = panels_panel_settings($display);
$form = array_merge($form, $form_additions);
?>
If none of those make any difference, then download and install the devel module (http://drupal.org/project/devel) and change that problematic line to the following:
<?php$form_additions = panels_panel_settings($display);
dvm($form_additions);
dvm($form);
?>
The form will definitely be screwed up, but it should at least render the page; copy/paste the huge stack of variables that gets dumped to the screen into a reply to this thread.
#20
Yes, I am also getting this error:
Fatal error: Unsupported operand types in /home/WWW/mysite.com/sites/all/modules/panels/includes/display_edit.inc on line 517
I am using beta4b and did not have this issue until upgrading from the previous beta. I do have advanced profile installed, so maybe there is a conflict...
#21
Of course ... I meant it is the same message, not the exact same error. As I said in post #16, if the expectation was to open a new issue, that's fine. However it seemed a bit redundant when the new issue would be the same title and error message.
Prior to testing your conditions in post #19, I had cleared cache, cleared all local cache, and re-saved the existing mini-panel. I'm not sure if this played any part, but I'm no longer getting the fatal error.
I did mention here that there seems to be a problem with how Advanced Profile is building its default panels. They worked with beta3, but the out-of-the-box panels don't work with beta4b. I have reported this to the Advanced Profile issues log.
#22
Re-saving the existing mini-panel is likely to have been what solved the problem. No panels-related data is stored in any of the normal 'cache' tables; clearing them ought not have had any effect on panels. It's more likely that some of the checking routines that were instituted in beta4 kicked in when you re-saved the mini-panel, solving the data inconsistency issue that was responsible for generating the fatal error in the first place.
#23
Automatically closed -- issue fixed for two weeks with no activity.