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.
Comment | File | Size | Author |
---|---|---|---|
#13 | statistics_truncate_title-1274406-13.patch | 2.4 KB | marcingy |
#10 | statistics_truncate_title-1274406-10.patch | 2.48 KB | marcingy |
#1 | statistics_truncate_title-1274406-1.patch | 608 bytes | grndlvl |
Comments
Comment #1
grndlvl CreditAttribution: grndlvl commentedComment #3
Everett Zufelt CreditAttribution: Everett Zufelt commented#1: statistics_truncate_title-1274406-1.patch queued for re-testing.
Comment #4
Everett Zufelt CreditAttribution: Everett Zufelt commentedComment #6
catchStrange test failure. This needs a test for title being too long.
Comment #7
marcingy CreditAttribution: marcingy commentedThis seems like a duplicate of #1222434: Writing to accesslog error when node title 255 chars
Comment #8
marcingy CreditAttribution: marcingy commentedComment #9
marcingy CreditAttribution: marcingy commentedIn 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.
Comment #10
marcingy CreditAttribution: marcingy commentedNew 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.
Comment #11
catchTagging for backport.
Comment #12
catchWe should say unicode.inc here, otherwise looks good to me.
Comment #13
marcingy CreditAttribution: marcingy commentedAmend the comment to unicode.inc
Comment #14
catchLooks good to me, marking rtbc and will commit in a couple of days if no objections.
Comment #15
catchCommitted/pushed to 8.x, moving to 7.x.
Comment #16
webchickCommitted and pushed to 7.x. Thanks!