The patch simply checks that the item is in fact an array before trying to merge.

Warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array in theme_linkimagefield_imagecache() (line 291 of /sites/all/modules/linkimagefield/linkimagefield.module).
CommentFileSizeAuthor
#1 linkimagefield_patch_1053284.patch661 bytestseven

Comments

tseven’s picture

StatusFileSize
new661 bytes

Here is the patch.

testertesters’s picture

I also ran into this problem, and another related: A node with no data in the linkimage field would still output an image tag with source set to the sites root url. This was with views, using imagecache, and despite "Hide field if empty" was checked. I fixed it by adding to linkimagefield.module in function theme_linkimagefield_imagecache($element):

	if(!$item['filepath']) {
		return '';
	}

after this code:

	if (is_string($item['data'])) {
		$item['data'] = unserialize($item['data']);
	}
pfrenssen’s picture

Status: Needs review » Needs work

Do you have an example of a use case when a variable is passed here that is not an array? I'd like to check what is going on then since I don't really agree with the patch. It suppresses the warning but in doing this it actually skips the code that is responsible for retrieving the file path, so it will result in an empty path in the image tag. I'd like to know if it is possible to retrieve the image somehow, perhaps it is passed in another part of the element. In any case if the image can not be generated correctly it should not output useless HTML as described by testertesters in comment #2.

sickness29’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Development or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.

Everyone can apply the patch above (not tested by the maintainers, tested by the community) to their D6 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.