Download & Extend

Error when saving nodes with link field

Project:Link
Version:6.x-2.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I am getting this error when I save a node:
( ! ) Fatal error: Cannot use string offset as an array in /webs/mysite.com/sites/mysite.com/modules/link/link.module on line 249

I've added a chek of is_array for $item['attributes'] in _link_process function

<?php
 
if (is_array($item['attributes'])) {
    if (!
$item['attributes']['target'] || $item['attributes']['target'] == "default") {
      unset(
$item['attributes']['target']);
    }
  }
?>

I am attaching a patch.

Comments

#1

here is the patch

AttachmentSize
link-519848.patch 711 bytes

#2

Version:6.x-2.6-beta3» 6.x-2.6
Status:active» needs review

Checking if the variable is an array fixes the problem, but the correct solution would be to initialize the attributes array so that we don't have is_array() checks everywhere in the code.

#3

Status:needs review» postponed (maintainer needs more info)

Could you please check with the current development snapshot and report back if the issue continues ?

#4

Status:postponed (maintainer needs more info)» closed (fixed)

fixed a year ago. we are @ 6.x-2.9