Problem/Motivation

I am receiving this warning 1071 times on /admin/panopoly/panes

Warning: array_key_exists() expects parameter 2 to be array, null given in panopoly_admin_general_panes_content_type_render() (line 44 of /sites/all/modules/contrib/panopoly_admin/plugins/content_types/general_panes.inc).

Steps to Reproduce

Environment

PHP 5.5.9
Apache 2.2.24
OS X Mavericks

Minimum Setup:

drush dl drupal
drush si --db-url=mysql://root:root@localhost/panopoly --account-name=admin --account-pass=admin standard
drush dl panopoly --select 1
drush en panopoly_admin -y

Login and go to http://localhost/admin/panopoly/panes

Proposed resolution

@todo

Remaining tasks

  • Confirm issue
  • Write patch
  • Review Patch
  • Commit Patch

API changes

n/a

Comments

joelpittet’s picture

Issue summary: View changes
joelpittet’s picture

Issue summary: View changes
joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new933 bytes

variable_get() allows you to set a default and in this case array() would be a better default to expect, this fixes the issue. Though maybe this line could have a second look at the logic:

$category_enabled = (!empty($panels_page_default_types[$category_name]) || !array_key_exists($category_name, $panels_page_default_types)) ? TRUE : FALSE;

Maybe it should be:

      $category_enabled = (isset($panels_page_default_types[$category_name]) || array_key_exists($category_name, $panels_page_default_types)) ? TRUE : FALSE;

Reference:
http://www.zomeoff.com/php-fast-way-to-determine-a-key-elements-existanc...

mrfelton’s picture

Status: Needs review » Fixed

Committed a fix for this based on the patch above in http://drupalcode.org/project/panopoly_admin.git/commit/b88dea5.

Status: Fixed » Closed (fixed)

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