Hi,

I'm using your module which i find pretty and useful, i've set it up correctly, works fine for logged and anonymous users BUT only after the first visit on the node.
That is a major problem if you consider that if a never-visited-user clicks on a search engine result and navigates to my node(s), for the first time the site will fail giving the following error:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'sid' at row 1: INSERT INTO {recently_read} (sid, entity_id, type, language, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 1010428 [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => en [:db_insert_placeholder_4] => 1374834711 ) in recently_read_entity_view() (line 68 of /MY_WEBSITE_FOLDER/sites/all/modules/recently_read/recently_read.module).

Keep in mind that i have already tried all the "stable" versions of your module. The above message comes from the dev one.

The problem is that in that particular line of recently_read.module file, the function session_api_get_sid() returns nothing and that causes the following query to fail:

$status = db_merge('recently_read')
                  ->key(array(
                    'sid' => session_api_get_sid(),
                    'entity_id' => $entity->{$info[$type]['entity keys']['id']},
                    'type' => $type
                  ))
                  ->fields(array(
                    'type' => $type,
                    'language' => $langcode,
                    'timestamp' => REQUEST_TIME,
                  ))
                  ->execute();

Until you suggest me (and anyone else facing the same issue) a solid solution, i've came up with a little bit tweaking code in that point.

Please help!

Comments

zterry95’s picture

Thanks for report this.
fixed in 9beff93.

So you properly need to

git clone --branch 7.x-3.x http://git.drupal.org/project/recently_read.git

To download the newest code and try it again.

If you still has problem on this. feel free to let me know. thanks.

m.ioannidis’s picture

Hi, zterry95,

Thank you for your immediate response but the link you provided seems dead to me.

Any ideas why?

EDIT: Nope! Strike that! Worked like a charm! Thank you for your quick fix!

zterry95’s picture

ah..
I think you properly need to learn how to use the git.

If you want to play with drupal better, git ability is some kind of necessary:)

m.ioannidis’s picture

As i mentioned above, it worked.
Thank you again for fixing your bug!

zterry95’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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