Download & Extend

Array given, but string expected as argument 1 for unserialize() in _link_load():315 (when title-attribute is user defined)

Project:Link
Version:7.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

This issue is probably related to Notice: Array to string conversion in _link_sanitize(), but as the error message is somehow different I opened an own issue for this.

After adding one or more fields of type "Link" with user-defined attributes and title (both, "real" title and attribute) to a custom content type, I'm getting this error message after creating a new node of that content type:

Warning: unserialize() expects parameter 1 to be string, array given in _link_load() (Line 315 in ${DRUPALHOME}/sites/all/modules/link/link.module).

Though, the new node is created, each link shows up just as a "<" character.

Comments

#1

Title:Array given, but string expected as argument 1 for unserialize() in _link_load():315» Array given, but string expected as argument 1 for unserialize() in _link_load():315 (when title-attribute is user defined)

Additional info:
This problem only occurs, when the "title" attribute is chosen to be defined by the user. Disabling the option "Allow the user to enter a link 'title' attribute" dismisses the warning message.

However, the aforementioned problem while displaying the link only the "<" character shows up, seems not related to this issue.

#2

Priority:major» normal

thanks 4 report, torbjoernk. I will try to reproduce.

#3

I experience the same issue when I work on the issue #1417520: Fire hook_field_load and hook_field_attach_load for fields when aggregation is used..

In that issue, it tries to call hook_field_load and hook_field_attach_load when view renders a row, and that triggers this error.

I think any one use field API to do field_load / field_attach_load might experience the same thing.

A patch is provided to check if the attribute is a string, if so, unserialize, otherwise if it's already an array, return the array itself.

AttachmentSize
views-add-field-post-processing-when-grouping-link.patch 694 bytes