The database field for titles in rss feed items is limited to 255 characters and in some very rare cases, the real title of a feed item can be longer. just happened to me today and that crashes cron, because aggregator_save_item() throws a database error when trying to save that item with the long title.

I think that should be catched by truncating the title upfront if it was longer than 255 character. This could be done with

    if (strlen($edit['title']) > 255) {
      $edit['title'] = substr($edit['title'], 0, 255);
    }

in line 141 of aggregator.processor.in

Comments

mile23’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still happening? Can you make a patch?

If it's still happening I suggest bumping it up to 8.x-dev.

jurgenhaas’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new582 bytes

Yes, this is still happening and I wonder why it shouldn't go into the D7-dev branch for one of the next releases. Anyway, the patch is attached and needs review.

jurgenhaas’s picture

Version: 7.0-beta2 » 7.0

Updated version tag.

Status: Needs review » Needs work

The last submitted patch, aggregator_savce_item_984166.patch, failed testing.

jurgenhaas’s picture

StatusFileSize
new582 bytes

Trying again but I'm not sure how to change the line endings (being in NetBeans on a Mac) and to be honest, it feels a bit stupid that the test bot doesn't accept simple text files.

bfroehle’s picture

Status: Needs work » Needs review

Setting to CNR to trigger the bot.

jurgenhaas: I know changing around your workflow/settings is annoying, but be aware that the patch -p0 style patches (as you posted in #2 and #5) will be phased out in the next month or two in favor of the git default (patch -p1) style. See http://drupal.org/patch/create.

Status: Needs review » Needs work

The last submitted patch, aggregator_save_item_984166.patch, failed testing.

jurgenhaas’s picture

Status: Needs work » Needs review
StatusFileSize
new568 bytes

So here is another try (Tip: there is a line-endings plugin for NetBeans = very helpful)

beatnykk’s picture

same here, this should be patched in next drupal core.

so far i was doing it manually this way :

function aggregator_save_item($edit) { $shorten = substr($edit['title'], 0, 250)." ...";
  if ($edit['title'] && empty($edit['iid'])) {
    $edit['iid'] = db_insert('aggregator_item')
      ->fields(array(
        'title' => $shorten,
        'link' => $edit['link'],
        'author' => $edit['author'],
        'description' => $edit['description'],
        'guid' => $edit['guid'],
        'timestamp' => $edit['timestamp'],
        'fid' => $edit['fid'],
      ))
      ->execute();
  }
lyricnz’s picture

Status: Needs review » Needs work

It's not just the title field that could overflow, but the link+author+guid elements in aggregator_item could also be > 255 chars.

twistor’s picture

Closing as dupe of #1244116: Feed items with title longer than 255 characters fail to insert into aggregator_item since the work seems to be going on there. The other fields link, author, guid should be addressed separately. There doesn't seem to be a problem with those in the wild, however, the theoretical problem still exists.

twistor’s picture

Status: Needs work » Closed (duplicate)

There we go.