Needs work
Project:
Link
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Aug 2011 at 18:46 UTC
Updated:
8 Jan 2019 at 15:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #0.0
ldw-1 commentedWarning: unserialize() expects parameter 1 to be string, array given in _link_load() (line 262 of /var/www/.../modules/link/link.module).
Comment #1
Pocketpain commentedSame...sub
Comment #2
Pallie commentedChanging:
return unserialize($item['attributes']);
Into:
return $item['attributes'];
in the _link_load() function on line 262 in the link.module file, seems to fix this issue, and I can't find any impact on other things by removing the unserialize() call...
Comment #3
dqdPlease use latest --dev and re-test! Many known issues are fixed in latest --dev.
If the error still occurs, please come back to report on a new issue for latest --dev since we push for the coming beta release.
Your reports are much appreciated! thank you!
Comment #4
bcn commentedWhile testing with the latest dev release I got:
Warning: unserialize() expects parameter 1 to be string, array given in _link_load() line 292...
The change mentioned by Pallie does remove the warning, but I am also unsure if that's the correct fix.
Comment #5
dqdokay. do we have #2 committed? not sure. I will check it this night (CET)
Comment #6
bcn commentedcode from #2 has not been committed, but I it would be wise to make sure there are not some side effects to removing the unserialize, as suggested.
Comment #7
dqdnoahb, thanks 4 info. I am stil not sure if this is the right point to patch, since I had some other commits to run last days and calling unserialize() will surely have its reason here.
Comment #8
dankobiaka commentedThe issue seems to lie with the code that is doing the serializing.
By testing if the variable is not a string before serializing, this results in string values being stored as plain text - therefore causing an error when trying to unserialize.
To resolve the issue, _link_process() needs to be coded to always serialize $item['attributes']
Comment #9
dqd#dankobiaka, thanks for trying to help. Can you please provide a patch. It is better for understanding the code change, where the change is made, better for the flow (forth and back versioning) and can be easier committed with your credits to the repo.
Comment #10
bcn commentedpatch from #8
Comment #11
dankobiaka commentedThe issue with attributes seems to be even more serious.
It appears as though _link_sanitize() is being called on node insertion, resulting in the attributes array being unserialized before getting written to the database. This is causing a fatal SQL error.
In those cases, link_field_prepare_view() is getting called on node insertion BEFORE the field is written to SQL storage.
The error is not occurring in all cases for me and I'm not quite sure what to tell you in order to reproduce it (I have multiple link fields on the node).
I am using Drupal 7.9 and Link 7.x-1.x-dev.
See my comment at http://drupal.org/node/1290904#comment-5173082
Comment #12
minhtao commentedsubscribe
Comment #13
ladybug_3777 commentedStill waiting for a resolution for this issue. Wanted to comment so that it's still seen as an open problem.
Comment #14
p5B0EODLAElkqmSm commentedsubscribe
Comment #14.0
p5B0EODLAElkqmSm commentedAdded the directory structure included in the error message.
Comment #15
chris matthews commentedThe 7 year old patch in #10 to link.module does not apply to the latest link 7.x-1.x-dev and if still applicable needs a reroll.