test case:

run: watchdog('dblog', 'test link', array(), WATCHDOG_NOTICE, l('view', 'test/'. str_repeat('ol', 200)));
go to admin/report/dblog page

Search queries from site might produce link like this. So perhaps it is issue of search module too

Comments

vectoroc’s picture

ways that I see:

  • quick hack - change link column type to text
  • shorten url with help of module like shorturl
  • ensure that link is not broken :
    • strlen($link) == 255 # perhaps the link is broken
    • check_markup($link, FILTER_FORMAT_DEFAULT, FALSE);

Also there is conceptual problem that might be related to the issue: message field is translatable but link field is not.

vectoroc’s picture

Status: Active » Closed (duplicate)

#1145700: improve sanitization of watchdog link/operations item fixes the problem too
marking as duplicate

Oleksandr.Masovets’s picture

Status: Closed (duplicate) » Active

Reopen the ticket. Because it's not about sanitization but about correct format of the $link.

Problem:
I have the node with url, which contains cyrillic letters in it (e.g. 'ru/news/201109/свежачок-9-украинские-музыкальные-новости'). When i do node save the dblog_watchdog function crushes because of the $log_entry['link'] varialble.

The source path ('ru/news/201109/свежачок-9-украинские-музыкальные-новости') was cleaned up with check_plain function and all cyrillic letters was converted to HEX chars.

And now the $log_entry['link'] looks like <a href="/ru/news/201109/%D1%81%D0%B2%D0%B5%D0%B6%D0%B0%D1%87%D0%BE%D0%BA-9-%D1%83%D0%BA%D1%80%D0%B0%D0%B8%D0%BD%D1%81%D0%BA%D0%B8%D0%B5-%D0%BC%D1%83%D0%B7%D1%8B%D0%BA%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5-%D0%BD%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D0%B8">просмотр</a> which is more than 255 chars length.

After the substr() function on line 151 of the dblog.module the $log_entry['link'] looks like <a href="/ru/news/201109/%D1%81%D0%B2%D0%B5%D0%B6%D0%B0%D1%87%D0%BE%D0%BA-9-%D1%83%D0%BA%D1%80%D0%B0%D0%B8%D0%BD%D1%81%D0%BA%D0%B8%D0%B5-%D0%BC%D1%83%D0%B7%D1%8B%D0%BA%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5-%D0%BD%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D0%B8">про� and db_insert() function can't insert it into DB.

It will be better to save the original path like 'node/1' instead of alias. The original path in most cases is short, clean and acceptable for the db_insert() function. Also you don't care about 'old' aliases anymore, which was added into watchdog table. You always have the original path and easily can get correct alias.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.