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
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 517

I 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

David Orr - May 26, 2008 - 22:43

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

amccann - May 27, 2008 - 05:22

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

David Orr - May 27, 2008 - 06:38

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

ugerhard - May 27, 2008 - 07:45

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

bangpound - May 27, 2008 - 14:49

The += is crucial, and it exists in prior betas of Panels 2.

I'm also getting the error on panel pages now, too.

#6

bangpound - May 27, 2008 - 15:17

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

Zach Harkey - May 27, 2008 - 16:03
Priority:normal» critical

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

sdboyer - May 27, 2008 - 16:35

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:

<?php
function 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:

<?php
function 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

bangpound - May 27, 2008 - 17:28

the fatal error disappears after making the change suggested by sdboyer in #8. Thanks! I am proceeding with BETA4 again.

#10

sdboyer - May 27, 2008 - 19:28
Status:active» fixed

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

sun - May 27, 2008 - 19:33

Thanks, I was about to post a patch for this, too. ;)

#12

backdrifting - May 30, 2008 - 15:15
Version:5.x-2.0-beta4a» 5.x-2.0-beta4b

Just a note - I tried this fix today (per post #8 above) and it worked.

Thanks!

#13

ron_s - May 30, 2008 - 20:32
Status:fixed» active

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.

#16

Going back to the second example I gave in post #10, the Advanced Profile has the same issue, but no ability to change any context settings. This problem is fairly easy to reproduce. Here is the scenario that I ran:

Once this is set up, visit the admin's account. (Note -- Make sure to follow the instructions; just installing the modules above will not work) With beta4b, it will be a blank page. If the beta4b code is removed and the beta3 code is put back in place, the Advanced Profile page for the admin will be displayed.

---------------------------

#17

One other item I forgot to mention ... once the Advanced Profile is set up, go into the Guestbook mini-panel, and click the Layout Settings tab. Returned is the following error message:

Fatal error: Unsupported operand types in /htdocs/sites/all/modules/panels/includes/display_edit.inc on line 517

---------------------------

#18

Ron_s: see #262956: Fatal error for mini panels layout settings

---------------------------

#19

"Ron_s: see #262956: Fatal error for mini panels layout settings"

I see you had crossed it out ... assuming you noticed this doesn't fix it. :) I had applied the $form = array(); fix a couple of days ago and doesn't work in this circumstance.

Sorry to create two issues in one thread -- maybe it makes sense to keep #263845 focused on the panel disappearing for Advanced Profile and #262956 on the error from the Layout Settings tab for the Guestbook mini-panel?

#14

activelyOUT - June 1, 2008 - 17:39

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

sun - June 1, 2008 - 17:48
Status:active» fixed

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

ron_s - June 1, 2008 - 22:59
Status:fixed» active

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

arcX - June 4, 2008 - 10:37

Works for me with $form = array();

#18

ron_s - June 5, 2008 - 03:35

Ok ... works for you with $form = array() ... are you using Advanced Profile module?

#19

sdboyer - June 6, 2008 - 16:01
Status:active» active (needs more info)

Point of order, re: #16 - there is no possible way for it to have been

the exact same fatal error

, 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

bomarmonk - June 6, 2008 - 16:39

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

ron_s - June 6, 2008 - 21:41
Status:active (needs more info)» fixed

Though the error text may be the same, that doesn't mean that the ERROR is the same

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

sdboyer - June 7, 2008 - 05: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

Anonymous (not verified) - June 21, 2008 - 05:34
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.