You can see the lines in the code below where the error occurs. The 3 lines with + signs is the code added in as a workaround. Doing print_r($minis); you can see that the very first array item is empty (NULL) and I suspect this happened when I deleted a panel but I am unsure.

Array
(
    [] => 
    [news_menu] => stdClass Object
        (
            [pid] => 16
            [name] => news_menu

<?php
67 function panels_mini_block_info() {
68  // Safety: go away if CTools is not at an appropriate version.
69   if (!defined('PANELS_REQUIRED_CTOOLS_API') || !module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
70     return array();
71   }
72
73   $blocks = array();
74
75   $minis = panels_mini_load_all();
76   foreach ($minis as $panel_mini) {
77     if (empty($mini->disabled) && empty($mini->requiredcontext)) {
+       if (!isset($panel_mini->name)) {
+         continue;
+      }
78       $blocks[$panel_mini->name] = array(
79         'info' => t('Mini panel: "@title"', array('@title' => $panel_mini->admin_title)),
80         'cache' => DRUPAL_NO_CACHE,
81       );
82     }
83   }

Comments

merlinofchaos’s picture

Hm. Yeah the load_all() shouldn't be able to bring up an empty panel.

There does seem to be a mismatch there betwen $panel_mini and $mini.

Reg’s picture

I'm not sure what you mean by mismatch. Do you mean line 77 which should probably be $panel_mini?

merlinofchaos’s picture

76   foreach ($minis as $panel_mini) {
77     if (empty($mini->disabled) && empty($mini->requiredcontext)) {

The code is looping over $minis as $panel_mini but is testing $mini-> -- that is a potential problem in this code.

Reg’s picture

It's a bug but unrelated in the sense that if it's NULL you are still trying to reference a property of a non-object although using empty(...) as it does might allow you to get away with it since empty is pretty forgiving. I don't know the specifics regarding this usage. Better would probably be something like:

if (is_object($panel_mini) && empty($panel_mini->disabled) && empty($panel_mini->requiredcontext)) {
merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

The mismatch in variables is fixed in #1212492: Incorrect use of $mini in panels_mini_block_info()

The problem here is that load_all() should not be able to bring up an empty. It simply shouldn't. So if there's a bug, it's not in this part of the code. This is simply where the bug is revealed.

Figuring out why your load_all has an invalid object in it is the key.

Letharion’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
SunRhythms’s picture

This patch worked here... *duplicate entry yet later for those that are still looking for resources*
http://drupal.org/node/1480366

SunRhythms’s picture

Issue summary: View changes

.