If the region ends up empty, you'll get an error since $block_data[$block_key] isn't an array.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

BTW error is Fatal error: Unsupported operand types in /sites/all/modules/ds/modules/ds_extras/ds_extras.module on line 230

swentel’s picture

Status: Needs review » Fixed

Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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

victoriachan’s picture

Thanks for the earlier fix, and thanks for committing it so promptly.

But when my custom ds region is empty, the $block_data[$block_key] variable is not only not an array, it is not set, and hence triggering this Drupal notice:

Notice: Undefined index: page_sidebar_top_ds in ds_extras_field_attach_view_alter() (line 218 of /private/var/www/drupal7-test/sites/all/modules/ds/modules/ds_extras/ds_extras.module).

I know that I can just set my php.ini to ignore such notices, but it is probably better to fix it in the code since this is a valid complaint.

Proposed fix is to add an additional isset to check if the variable is set:

if (isset($block_data[$block_key]) && is_array($block_data[$block_key])) {
$block_data[$block_key] += $properties;
}

Patch attached (to be applied over the latest 7.x-1.x-dev / 7.x-1.4 with the previous patch already commited).

kreatIL’s picture

Status: Closed (fixed) » Needs work

Just tried out the patch posted by victoriachan (#4). Since it is very helpful I would appreciate it to be commited.

swentel’s picture

Status: Needs work » Fixed

Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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

kreatIL’s picture

Status: Closed (fixed) » Needs work

After installing the update to 7.x-1.5 today, the error messages went back. Manually re-patching (#4) ds_extras.module made the error go away again.

swentel’s picture

Status: Needs work » Fixed

Ah crap, somehow, this didn't got in, sorry about that :/ Pushed and committed.

kreatIL’s picture

Never mind! Thx for finally committing :)

Status: Fixed » Closed (fixed)

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

aschiwi’s picture

Thanks for the patch :)