Hi there,

When working with fields that have no itemprop or itemtype, Microdata causes an undefined index notice and a warning on the array_merge on lines 441, 460 and 467 of microdata.module.

Ideally, the microdata attributes should be checked to see if they exist before being merged.

Notice: Undefined index: value in microdata_preprocess_field() (line 433 of /sites/client/www/sites/all/modules/vendor/microdata/microdata.module).
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in microdata_preprocess_field() (line 433 of /sites/client/www/sites/all/modules/vendor/microdata/microdata.module).

CommentFileSizeAuthor
#1 microdata-missing-attributes-1776866-1.patch2.1 KBAnonymous (not verified)

Comments

Anonymous’s picture

Here's an attempt at a patch to fix this.

Anonymous’s picture

Status: Active » Needs review
Poieo’s picture

I'm getting the following error for anonymous users only. Unfortunately this patch does not solve the problem for me.

Warning: array_merge(): Argument #2 is not an array in microdata_preprocess_field() (line 415 of .../modules/microdata/microdata.module).
Anonymous’s picture

Status: Needs review » Postponed (maintainer needs more info)

I haven't been able to reproduce this. I also designed it so this shouldn't happen. If a field is defined on a bundle and it doesn't have a mapping, it should automatically get an empty microdata attributes array.

Can you please test again with the latest dev version and try clearing your caches?

Also, if you know which field is triggering this issue and its field type, that could help debug this.

Poieo’s picture

I haven't been able to reproduce the issue with the latest dev. If the error comes back I'll re-post.

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thank you for testing. I'm going to close this out for now, let me know if it comes up again.

Status: Fixed » Closed (fixed)

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

daemonchrist’s picture

Status: Closed (fixed) » Active

I'm still getting this with latest dev build.

The patch above contains a fatal error: an extra ")". Even after correcting that, the issue still exists.

Additionally, I think this is an exact duplicate of an older bug: #1692220: Undefined index: #formatter microdata_preprocess_field()

daemonchrist’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)