I get this error after the update.

Notice: Array to string conversion in _link_sanitize() (line 447 of /home/htdocs/bamboo_apps/pub/sites/all/modules/link/link.module).

.

I have tried latest dev version, I have tried uninstall and database update but nothing helped to stop displaying this error! (Still trying different ways to find out a solution).
If any one could help, would be greatly appreciated.

Thanks in advance.

Comments

Bright Web Design’s picture

StatusFileSize
new25.93 KB

I found the solution for the issue. It was because of the change in the structure of the latest updated version of the link module.

Please see the attached screen shot to understand what I say.
Now it's a headache for me to rewrite all the links I have made.

I hope this info will others who come up with same issue.

Best Wishes

modulist’s picture

+1 subscribing. We're running into the same issue on two sites currently in development, with hundreds of nodes already imported into each one.

jcfiala’s picture

Title: Notice: Array to string conversion in _link_sanitize() » Change in Structure of link code needs a hook_update_N implementation

Changing the issue title - the problem isn't so much the Notice, as the fact that I moved things around and didn't produce a proper hook_update_N implementation to move the data.

jcfiala’s picture

Status: Active » Fixed

This shouldn't require changing the link data, just the field data. That being said, I've created an update hook in link.install and comitted it just now - sometime soon (tomorrow?) you should be able to pull down the 7.x-dev version and run that. Let me know how that works, please.

modulist’s picture

Thanks for trying... I tried swapping out the 7.x.dev version and running update.php. I'm still getting an error, but on line 449 now:

Notice: Array to string conversion in _link_sanitize() (line 449 of /var/www/sites/clients/umiacs/dev/docroot/sites/all/modules/link/link.module).
jcfiala’s picture

Status: Fixed » Needs work

Well, we need to change the Status if that didn't work. Hmm.

jcfiala’s picture

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

modulist, can you get me what's in field_config and field_config_instance for the field in question? The status of the fields after you've run the update would be great, although if you can also let me know what were in these fields before an after the update that would be useful for seeing what's going on in your code.

Also, what are you doing when you get the error? Viewing the node? submitting the node?

Thanks.

(Anyone else having this same error, after pulling down the latest code and running the update, that would be useful as well to get your data.)

dqd’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Fixed

since this issue is almost half a year old I close it since somebody can reproduce the error in latest dev release ...

Status: Fixed » Closed (fixed)

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

alan d.’s picture

Version: 7.x-1.0-alpha3 » 7.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new2.3 KB

I'm not fully sure if this is a upgrade issue. We are getting this on new sites that only runs on 7.x-1.0. Tracking down the error link, it is the rel attribute and a piece of code that is not working.

So in link_field_prepare_view() prior to _link_sanitize() we have an $item:

    url (String, 4 characters ) www.
    title (String, 6 characters ) Google
    attributes (Array, 1 element)
        title (String, 0 characters ) 

afterwards we have:

    url (String, 4 characters ) www.
    title (String, 6 characters ) Google
    attributes (Array, 1 element)
        rel (Array, 4 elements)
            title (String, 0 characters )
            class (String, 0 characters )
            rel (String, 0 characters )
            configurable_title (String, 1 characters ) 1
    display_url (String, 16 characters ) http://htsa/www.
    html (Boolean) TRUE

Internally, we have this:


  // Remove the rel=nofollow for internal links.
  if ($type != LINK_EXTERNAL && strpos($item['attributes']['rel'], 'nofollow') !== FALSE) {
    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']);
  }

which should be

  // Remove the rel=nofollow for internal links.
  if ($type != LINK_EXTERNAL && strpos($item['attributes']['rel'], 'nofollow') !== FALSE) {
    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']['rel']);
  }

This is not an issue on most sites as field_attach_prepare_view() will only be called once. On sites that have multiple calls (this is normal), the 'rel' is an array second time through and the warning is triggered.

alan d.’s picture

Title: Change in Structure of link code needs a hook_update_N implementation » Notice: Array to string conversion in _link_sanitize().

Updating the title to the only issue that appears to remain.

dqd’s picture

dqd’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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