warning: array_merge() [function.array-merge]: Argument #2 is not an array

typehost - November 3, 2009 - 11:21
Project:Chaos tool suite
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

fresh Drupal installation, Panels 6.x 3.2 and Chaos Tools 6.x 1.2 - created panels page & set it to front page, receiving this error:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../public_html/sites/all/modules/ctools/includes/context.inc on line 197.

#1

typehost - November 3, 2009 - 11:53

note: the error appearing with advanced search block & goes away with simple search block.

#2

merlinofchaos - November 3, 2009 - 19:37

Can you please paste an export of the page you created that is demonstrating this error?

#3

typehost - November 4, 2009 - 10:42

Again, I have search and faceted search enabled in the panels page, but when adding "advanced search" block - I get the error.

$page = new stdClass;
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'start';
$page->task = 'page';
$page->admin_title = 'start';
$page->admin_description = '';
$page->path = 'start';
$page->access = array();
$page->menu = array();
$page->arguments = array();
$page->conf = array();
$page->default_handlers = array();
$handler = new stdClass;
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_start_panel_context';
$handler->task = 'page';
$handler->subtask = 'start';
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
  'title' => 'Panel',
  'no_blocks' => FALSE,
  'css_id' => '',
  'css' => '',
  'contexts' => array(),
  'relationships' => array(),
  'access' => array(
    'logic' => 'and',
  ),
);
$display = new panels_display;
$display->layout = 'twocol_stacked';
$display->layout_settings = array();
$display->panel_settings = array();
$display->cache = array();
$display->title = 'Search, Rate, and Review Airplane Repair Shops';
$display->hide_title = FALSE;
$display->title_pane = 3;
$display->content = array();
$display->panels = array();
  $pane = new stdClass;
  $pane->pid = 'new-1';
  $pane->panel = 'top';
  $pane->type = 'block';
  $pane->subtype = 'faceted_search_ui-1_keyword';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'override_title' => 1,
    'override_title_text' => '<none>',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 0;
  $display->content['new-1'] = $pane;
  $display->panels['top'][0] = 'new-1';
  $pane = new stdClass;
  $pane->pid = 'new-2';
  $pane->panel = 'top';
  $pane->type = 'block';
  $pane->subtype = 'search-0';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'override_title' => 1,
    'override_title_text' => '<none>',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 1;
  $display->content['new-2'] = $pane;
  $display->panels['top'][1] = 'new-2';
  $pane = new stdClass;
  $pane->pid = 'new-3';
  $pane->panel = 'top';
  $pane->type = 'block';
  $pane->subtype = 'gmap_location-0';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'override_title' => 1,
    'override_title_text' => '<none>',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 2;
  $display->content['new-3'] = $pane;
  $display->panels['top'][2] = 'new-3';
  $pane = new stdClass;
  $pane->pid = 'new-4';
  $pane->panel = 'top';
  $pane->type = 'search_form';
  $pane->subtype = 'search_form';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'type' => 'location',
    'form' => 'advanced',
    'path_type' => 'default',
    'path' => '',
    'override_prompt' => 0,
    'prompt' => '',
    'context' => 'empty',
    'override_title' => 1,
    'override_title_text' => '<none>',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 3;
  $display->content['new-4'] = $pane;
  $display->panels['top'][3] = 'new-4';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;

#4

jonskulski - November 5, 2009 - 20:09

Also receiving this error on my site, here is the export

$page = new stdClass;
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'lz_tv_commericals';
$page->task = 'page';
$page->admin_title = 'LZ TV Commercials';
$page->admin_description = 'LegalZoom TV commercials';
$page->path = 'press-center/press-media/tv';
$page->access = array();
$page->menu = array(
  'type' => 'normal',
  'title' => 'TV Commercials',
  'name' => 'secondary-links',
  'weight' => '0',
  'parent' => array(
    'type' => 'none',
    'title' => '',
    'name' => 'navigation',
    'weight' => '0',
  ),
);
$page->arguments = array();
$page->conf = array();
$page->default_handlers = array();
$handler = new stdClass;
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_lz_tv_commericals_panel_context';
$handler->task = 'page';
$handler->subtask = 'lz_tv_commericals';
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
  'title' => 'Panel',
  'no_blocks' => FALSE,
  'css_id' => '',
  'css' => '',
  'contexts' => array(),
  'relationships' => array(),
);
$display = new panels_display;
$display->layout = 'onecol';
$display->layout_settings = array();
$display->panel_settings = array();
$display->cache = array();
$display->title = 'TV Commericals';
$display->hide_title = FALSE;
$display->title_pane = 0;
$display->content = array();
$display->panels = array();
  $pane = new stdClass;
  $pane->pid = 'new-1';
  $pane->panel = 'middle';
  $pane->type = 'node';
  $pane->subtype = 'node';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'nid' => '2682',
    'teaser' => 0,
    'links' => 1,
    'leave_node_title' => 0,
    'identifier' => '',
    'override_title' => 1,
    'override_title_text' => '<none>',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 0;
  $display->content['new-1'] = $pane;
  $display->panels['middle'][0] = 'new-1';
  $pane = new stdClass;
  $pane->pid = 'new-2';
  $pane->panel = 'middle';
  $pane->type = 'views_panes';
  $pane->subtype = 'lz_tv_commercials-panel_pane_1';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'context' => array(
      '0' => 'context_node_1',
    ),
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array(
    'css_id' => 'tv-commercial',
    'css_class' => '',
  );
  $pane->extras = array();
  $pane->position = 1;
  $display->content['new-2'] = $pane;
  $display->panels['middle'][1] = 'new-2';
  $pane = new stdClass;
  $pane->pid = 'new-3';
  $pane->panel = 'middle';
  $pane->type = 'views_panes';
  $pane->subtype = 'lz_tv_commercials-panel_pane_2';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'context' => array(
      '0' => 'context_node_1',
    ),
  );
  $pane->cache = array();
  $pane->style = array(
    'style' => 'grey',
  );
  $pane->css = array(
    'css_id' => 'commercials-carousel',
    'css_class' => '',
  );
  $pane->extras = array();
  $pane->position = 2;
  $display->content['new-3'] = $pane;
  $display->panels['middle'][2] = 'new-3';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;

#5

jonskulski - November 5, 2009 - 20:57

I have two pages set up, the above export and a similar page that takes a Node argument. Both invoke a panel
pane (via views_content_pane) that has an optional argument via Node Context.

In panels/includes/plugins.inc on line 50

if (!$context) {
    $context = new ctools_context;
}  

If there is no context passed in, panels will constructs a new context object. It is then passed down to

<?php

/*
...
* @param $context
*   An array of context objects available for use.
..
*/
function ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '') {

which is expecting an array of contexts, not just one context object. This eventually causes a problem when
ctools_context_optional->add_empty tries to array_merge it.

I believe the fix is to create an array consisting of a new unknown object which is actually a panels issue.

#6

jonskulski - November 5, 2009 - 20:58
Status:active» needs review

I opened a panels issue and posted a patch: here http://drupal.org/node/624710

#7

jonskulski - November 10, 2009 - 20:54
Status:needs review» fixed

Related issue http://drupal.org/node/624710 was fixed. Patch accepted. Setting this to fixed.

#8

System Message - November 24, 2009 - 21:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.