For Search API attachments, 7.x-1.13. This error is reported on Node save event.

Recoverable fatal error: Argument 2 passed to SearchApiAttachmentsAlterSettings::isFileIndexable() must be of the type array, object given, called in sites/all/modules/contrib/search_api_attachments/includes/callback_attachments_settings.inc on line 43 and defined in SearchApiAttachmentsAlterSettings->isFileIndexable() (line 73 of sites/all/modules/contrib/search_api_attachments/includes/callback_attachments_settings.inc).

Looks like this was introduced when doing a "coding standards" clean up. Explicit array declaration was added to a function, which caused the issue. The variable is object, not an array.

Patch to be attached.

Comments

Agileware created an issue. See original summary.

agileware’s picture

Status: Active » Needs review
Issue tags: ++patch
StatusFileSize
new1.01 KB

Patch attached to fix this issue.

agileware’s picture

Priority: Normal » Major

Changing priority as the impact is a error message on node save.

markandrewsutton’s picture

I had the same issue with 7.x-1.12 and reported it here. https://www.drupal.org/project/search_api_attachments/issues/2971675

Same issue, but in my patch, I changed the function call rather than the function itself. This way the coding standards are maintained.

Not sure if this should be considered a duplicate issue?

agileware’s picture

@markandrewsutton the module uses $item as an object. Casting it as an array just to satisfy the function declaration as you did in 2971675 is OK as long as it updates all references.

The easiest solution IMHO is just to remove the array casting from the function.

I think the automated Drupal coding standards, read the comments for the function, which incorrectly listed item as an array. Then introduced the bug by prefixing array function declaration - that's the problem.

markandrewsutton’s picture

@agileware thanks for the explanation. This makes good sense. I'm going to update the other issue so others know to use this patch. Thanks!

helmo’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, #2 works.

  • izus committed 08bea4d on 7.x-1.x authored by Agileware
    Issue #2971834 by Agileware, markandrewsutton, helmo, izus: Recoverable...
izus’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all
This is now merged

EDIT : new release 7.x-1.14 is available

Status: Fixed » Closed (fixed)

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