When a title is > 253 characters a the following PDO exception is thrown:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'title' at row 1: INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => Edit Story HeadlineNulla quis justo at mi sollicitudin mollis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc iaculis magna eget neque malesuada accumsan. Praesent laoreet mattis justo, nec accumsan massa volutpat utHead [:db_insert_placeholder_1] => node/7/edit [:db_insert_placeholder_2] => http://example.com/node/7/edit?render=overlay [:db_insert_placeholder_3] => 127.0.0.1 [:db_insert_placeholder_4] => 4 [:db_insert_placeholder_5] => 8Xx2WSsUqHg79VcUxUN2emp_GRGuShrrpqAtqJsMX0s [:db_insert_placeholder_6] => 2503 [:db_insert_placeholder_7] => 1315587502 ) in statistics_exit() (line 90 of /DOCROOT/modules/statistics/statistics.module).

The reason is because the page title is used and since this can be > 255 characters attempts to populate the title field as such.

Ex. "Edit Story HeadlineNulla quis justo at mi sollicitudin mollis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc iaculis magna eget neque malesuada accumsan. Praesent laoreet mattis justo, nec accumsan massa volutpat utHead" <-- is what is trying to be thrown in Note the "Edit story " addition to the already 255 length title.

To fix this issue the title should be truncated to 255 characters when writing to the access_log.

will attach patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grndlvl’s picture

Status: Active » Needs review
FileSize
608 bytes

Status: Needs review » Needs work

The last submitted patch, statistics_truncate_title-1274406-1.patch, failed testing.

Everett Zufelt’s picture

Status: Needs work » Needs review
Everett Zufelt’s picture

Version: 7.x-dev » 8.x-dev
Priority: Normal » Major

Status: Needs review » Needs work

The last submitted patch, statistics_truncate_title-1274406-1.patch, failed testing.

catch’s picture

Title: PDO execption is thrown when saving a node with a title that is too long. » PDO exception is thrown when saving a node with a title that is too long.
Issue tags: +Needs tests

Strange test failure. This needs a test for title being too long.

marcingy’s picture

marcingy’s picture

Status: Needs work » Closed (duplicate)
marcingy’s picture

Status: Closed (duplicate) » Needs work

In the light of http://drupal.org/node/1284658#comment-5052848 reopening this issue and closing #1222434: Writing to accesslog error when node title 255 chars as this patch is working on the correct solution.

marcingy’s picture

Status: Needs work » Needs review
FileSize
2.48 KB

New version of patch which includes the test from #1222434: Writing to accesslog error when node title 255 chars and deals with anonymous stats not being logged.

catch’s picture

Issue tags: +Needs backport to D7

Tagging for backport.

catch’s picture

Status: Needs review » Needs work
+    // For anonymous users unicode will not have been loaded.

We should say unicode.inc here, otherwise looks good to me.

marcingy’s picture

Status: Needs work » Needs review
FileSize
2.4 KB

Amend the comment to unicode.inc

catch’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, marking rtbc and will commit in a couple of days if no objections.

catch’s picture

Version: 8.x-dev » 7.x-dev
Issue tags: -Needs tests

Committed/pushed to 8.x, moving to 7.x.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x. Thanks!

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