There is thrown a php notice because in _link_sanitize $element is never defined. This line is doing nothing right now. Can we simply delete this?

  if (is_array($element['#item']['attributes']['rel'])) {
    unset($element['#item']['attributes']['rel']);
  }
CommentFileSizeAuthor
#3 link-_link_sanitize-966442-3.patch832 byteskmadel
#2 966442-2.patch716 bytesjoelstein

Comments

pobster’s picture

Mehhhh... Change it to;

// Some old field data may have $element['#item']['attributes']['rel'] as an array, which will cause errors:
  if (isset($element['#item']['attributes']['rel']) && is_array($element['#item']['attributes']['rel'])) {
    unset($element['#item']['attributes']['rel']);
  }

...Just in case...

Pobster

joelstein’s picture

Status: Active » Needs review
StatusFileSize
new716 bytes

Actually, the problem is that $element is not defined in this function. It was probably meant to be:

// Some old field data may have $item['attributes']['rel'] as an array, which will cause errors:
if (is_array($item['attributes']['rel'])) {
  unset($item['attributes']['rel']);
}

This attached patch fixes the PHP notice.

kmadel’s picture

StatusFileSize
new832 bytes

Looks like #2 is a reverse patch or however you say that. Here is one that works for me:

twistor’s picture

Status: Needs review » Reviewed & tested by the community

Gets rid of the errors, and the logic seems sound to me. Can't verify it doesn't break old field data however.

aschiwi’s picture

Patch in #3 works for me, gets rid of the erros. Thanks everyone!

robinmofo’s picture

Any idea when this patch is going to make it into a release?

jcfiala’s picture

I've mostly been concentrating on getting link 7 ready, but I think I can spend some time this weekend going through the 2.9 bugs and seeing what patches can get applied so that at least the dev release holds the fix - after a week of reviews from folks on that, we could get a release soon before Drupalcon.

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Well, the patch didn't work because the function had been moved into link.inc, but the change has been committed to cvs.

Status: Fixed » Closed (fixed)

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

pydubreucq’s picture

Hi,
I had this error too after migrate to Pressflow and this patch works for me ;)
Bye

asb’s picture

Hi,

I'm getting this error in link 6.x-2.9 from 2010-Jun-14:

Notice: Undefined variable: element in _link_sanitize() (line 445 of /var/www/drupal/sites/all/modules/link/link.module).

Since this issue seems to have been fixed a while ago and the last release of 'link' was more than one year ago, could we please get a new stable release, including the fix?

Thank you!

emosbaugh’s picture

pretty please

carn1x’s picture

subscribe

sabeeln’s picture

patch in #3 worked..
thanx..

asb’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Confirming, patch from #3 seems to work.

dqd’s picture

#14, #15 - did you patched against latest dev or against 6.x-2.9 release ?

asb’s picture

"git apply" against 6.x-2.9.

dqd’s picture

thx 4 info, asb!

dqd’s picture

Assigned: Unassigned » dqd
jcfiala’s picture

I'm pretty sure the change for this got put into cvs then - git now - Digidog. I think the main thing is we don't have a release of 6.x-2.x branch in a long time.

That's why I'd made the ticket 'fixed' before.

chriscohen’s picture

Come on guys, this was reported in November 2010 and it's now June 2012 and there's no new release that fixes this! Please put out a release with this fix!

asb’s picture

RTBC since October 24, 2011. Well, maintaining the 8.x-1.x-dev release (and preparing for 9.x-1.x-dev :) seems to be more important than maintaining that boring old stuff people are actually using in production.

nesta_’s picture

Initialize $element['#item']['attributes']['rel'] = ''; pre line 445 .Version 6.2.9

jcfiala’s picture

Assigned: dqd » jcfiala

Reminding myself of this.

jcfiala’s picture

Status: Reviewed & tested by the community » Closed (fixed)