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.

Files: 
CommentFileSizeAuthor
#13 statistics_truncate_title-1274406-13.patch2.4 KBmarcingy
PASSED: [[SimpleTest]]: [MySQL] 33,700 pass(es).
[ View ]
#10 statistics_truncate_title-1274406-10.patch2.48 KBmarcingy
PASSED: [[SimpleTest]]: [MySQL] 33,275 pass(es).
[ View ]
#1 statistics_truncate_title-1274406-1.patch608 bytesgrndlvl
FAILED: [[SimpleTest]]: [MySQL] 35,978 pass(es), 4 fail(s), and 4 exception(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new608 bytes
FAILED: [[SimpleTest]]: [MySQL] 35,978 pass(es), 4 fail(s), and 4 exception(es).
[ View ]

Status:Needs review» Needs work

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

Status:Needs work» Needs review

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.

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.

Status:Needs work» Closed (duplicate)

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.

Status:Needs work» Needs review
StatusFileSize
new2.48 KB
PASSED: [[SimpleTest]]: [MySQL] 33,275 pass(es).
[ View ]

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.

Issue tags:+needs backport to D7

Tagging for backport.

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.

Status:Needs work» Needs review
StatusFileSize
new2.4 KB
PASSED: [[SimpleTest]]: [MySQL] 33,700 pass(es).
[ View ]

Amend the comment to unicode.inc

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.

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

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

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 7.x. Thanks!

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