CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Could not find valid session key
Pages: 1 [2]

Author Topic: Could not find valid session key  (Read 6847 times)

sibro

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 4.4.5
  • CMS version: Drupal 7.27
  • MySQL version: 5.5
  • PHP version: 5.4
Re: Could not find valid session key
January 10, 2014, 03:36:00 am
I have a similar problem. on 4.3.7

I looked in the code and the above patch does not look like it has been applied to the code base even in 4.4

The problem seems to only happen with IE on both event registration and contribution. We thought it had something to do with credit card payment but it fails for pay later. I looked in the logs and see no indication of any problems. One individual has it failing solid, I can't reproduce it on my machine.

Any assistance would be appreciated
Bruce

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
January 11, 2014, 11:19:05 pm
@sibro,

The patch has undergone some evolution since Hershel first posted. You'll find the changes in the initialize() function.

Ken

krypto

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 5
  • IT guy for @bhahumanists. Running Civi on WP.
    • British Humanist Association
  • CiviCRM version: 4.5.8
  • CMS version: WordPress 4.x
  • MySQL version: 5.5.x
  • PHP version: 5.5.x
Re: Could not find valid session key
March 07, 2014, 10:36:06 am
@sibro - did you get anywhere with this? We're getting occasional reports of it too, but like you I can't reproduce it.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
March 10, 2014, 10:24:24 pm
@krypto et al,

I've cracked a problem like this. See http://forum.civicrm.org/index.php/topic,31800.msg136241.html#msg136241

There's an easy test to see if your issue is the same as mine. Look at the Drupal sessions table for multiple rows sharing the same ssid.

Code: [Select]
select a.* from sessions a, sessions b where a.ssid = b.ssid and a.timestamp < b.timestamp
That query should return no rows, but if it does you're having the same issue as I did. There's a patch in that post to fix the issue.

krypto

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 5
  • IT guy for @bhahumanists. Running Civi on WP.
    • British Humanist Association
  • CiviCRM version: 4.5.8
  • CMS version: WordPress 4.x
  • MySQL version: 5.5.x
  • PHP version: 5.5.x
Re: Could not find valid session key
March 11, 2014, 05:48:54 am
Thanks! WordPress doesn't handle sessions in the same way, sadly. But looks like this could be very useful for Drupal.

avanoers

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
Re: Could not find valid session key
March 11, 2014, 07:52:09 am
Using drupal 7.26 Civicrm 4.4.4

I still have this issue with both undefined variable being
I get this error in my log files everytime a anonymous person visits any website page including drupal pages:
Notice: Undefined variable: _SESSION in CRM_Core_Session->__construct() (line 86...sites/all/modules/civicrm/CRM/Core/Session.php).

and the notice that a session has already been started
Notice: A session had already been started - ignoring session_start() in CRM_Core_Session->__construct() (line 87 ...sites/all/modules/civicrm/CRM/Core/Session.php).

I checked my session.php file to see if the code was updates and it does contain the patch as metioned below:
  function __construct()
     {
 if (!$_SESSION) {
 session_start();
 }
         $this->_session =& $_SESSION;
     }

Any help would be greatly appreciated.
Annelies

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
March 11, 2014, 03:35:48 pm
Annelies,

Is the notice ..

    Notice: Undefined variable: _SESSION

or

    Notice: Undefined variable: $_SESSION

The former would be very odd and suggest a typo using the $_SESSION variable.

avanoers

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
Re: Could not find valid session key
March 13, 2014, 08:31:45 am
Thank you Ken for helping with this issue.
The notice in Drupal log is this:
Notice: Undefined variable: _SESSION in CRM_Core_Session->__construct() (line 86 of .../modules/civicrm/CRM/Core/Session.php).
Severity   notice

AND

Notice: A session had already been started - ignoring session_start() in CRM_Core_Session->__construct() (line 87 of .../modules/civicrm/CRM/Core/Session.php).

In my session.php file in CiviCRM from line 84 to 90:
  function __construct()
     {
 if (!$_SESSION) {
 session_start();
 }
         $this->_session =& $_SESSION;
     }
Thank you for you help on this.

avanoers

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
Re: Could not find valid session key
March 13, 2014, 08:56:25 am
Ken I also applied the patch as per  http://forum.civicrm.org/index.php/topic,31800.msg136241.html#msg136241 that did not work.
Annelies

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
March 14, 2014, 05:18:20 am
@avanoers,

You seem to have a mutilated CRM/Core/Sessions.php

This is the __construct() function from 4.4.4 which I just downloaded.

Code: [Select]
  function __construct() {
    $this->_session = null;
  }

You seem to have applied an old patch from @hershel and a lot of water has gone under the bridge since then. Try restoring the original 4.4.4 code. The patch I supplied fixes a different issue to the one you're reporting.

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Could not find valid session key

This forum was archived on 2017-11-26.