I upgraded after setting $update_free_access = true; in settings.php in the Drupal 7 installation. I get this error:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'sid' 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] => Reports [:db_insert_placeholder_1] => admin/reports [:db_insert_placeholder_2] => http://X.X.X.X/~divya/drupal7/?q=admin [:db_insert_placeholder_3] => 10.0.1.3 [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => NpIJ6GyjOQ-RzHGDUXsLstJpX5myqC5VOedLBDiYFfQ [:db_insert_placeholder_6] => 299 [:db_insert_placeholder_7] => 1291697470 ) in statistics_exit() (line 91 of /path/to/drupal7/modules/statistics/statistics.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | test_session_id.txt | 374 bytes | carlos8f |
| #5 | 991046-accesslog-sid-length-5.patch | 2.28 KB | mikey_p |
| #4 | 991046-4-accesslog-sid-length.patch | 1.18 KB | carlos8f |
Comments
Comment #1
nimbupani commentedThe error goes away when I deselect "Enable access log" from admin/config/system/statistics
Comment #2
chx commentedConfirmed, http://api.drupal.org/api/drupal/includes--session.inc/function/drupal_s... generates a 98 character long session id and the sid column in the accesslog is 64 only vs sid in session which is 128
Comment #3
carlos8f commenteddoh. subscribing
Comment #4
carlos8f commentedPatch.
Comment #5
mikey_p commentedHere's a nearly identical patch with tests.
Comment #6
chx commentedQuick job, thanks.
Comment #7
carlos8f commentedThe tests pass on their own without the .install hunk. Looking at my {sessions} table, I'm seeing a 43-character sid. How is it possible to get a 98-character one?
Comment #8
carlos8f commentedHere's a test I did to see what this actually does:
In CentOS 5.5 64bit and Mac OS X i386, I get 43-character session IDs consistently. Can someone who can reproduce this bug run the above script and show a session ID longer than 64 characters?
Comment #9
carlos8f commentedDebug script attached.
Comment #10
andypostEDIT http://php.net/base64_encode Base64-encoded data takes about 33% more space than the original data.
Comment #11
chx commentedWhile the bug is real -- ie statistics need the same data length as session table -- it's not critical as I can confirm carlos' work and confirm i am an idiot 'cos i wrote the wrong test scripts -- i moved a ) to the wrong place :( we need the original reporter to tell us more about the OS and the database used 'cos if you look better at the query posted, that's 43 characters right there. And sid was 64 in D6 already.
Comment #12
carlos8f commentedThe tests need work since they happily pass without any fix.
Comment #13
chx commentedOK i reviewed CVS history and -- this is why we did not put update functions in modules before. See, some time in the ancient past we upped the sid in accesslog to 64 but for whatever demented reason we put that update in statistics.install. And so whoever upped some time in the ancient past from one ancient Drupal to Drupal 5 with statistics disabled have sid length set to 32...
Comment #14
chx commentedI reviewed a Drupal 5 checkout i had lying around and only blogapi, comment, statistics and of course system had updates. As far as I can see, the comment one does not change schema (and disabling comment if you have comments on the site is superb unlikely anyways), blogapi has a Drupal 6 counterpart and statistics is fixed up here. Drupal 6 already was running disabled modules updates as broken it was but it was doing the best it could.
Comment #15
carlos8f commentedI second the RTBC, this is a case of an outdated schema due to a deleted update function. Unfortunately in the old days, disabled modules didn't participate in updates. But now they do, so this new update should fix the issue.
Also: the new tests aren't totally relevant to this issue, but the extra coverage can't hurt.
Comment #16
webchickOk, Committed to HEAD. Thanks!