Problem/Motivation

Visiting any page results in a new session by default making it difficult to work with web accelerators like Varnish etc.

edit: I think it might also be the cause of the PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ... UPDATE {sessions} ... error when $conf[https] = TRUE; is set.

Proposed resolution

Start the temporary session only when the user is IP restricted, and not before.
And leave the drupal_session_start() triggering behaviour to Drupal.

Alternatively, couldn't we just set drupal_page_is_cacheable(TRUE); and be done, removing the need for the temporary session?

Remaining tasks

Create patch for new behaviour.

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

codebymikey’s picture

codebymikey’s picture

Added logic for lazy starting the PHP session as needed.

Drupal will handle the creation if there's an active session to pass back.

I'd recommend the non-session version in #2 as it's easier to work with.

codebymikey’s picture

Issue summary: View changes

  • smustgrave committed 59ee29de on 7.x-2.x
    Issue #3152850 by codebymikey: Don't start a PHP session unnecessarily (...
smustgrave’s picture

Status: Needs review » Fixed

Since a bug I'll include in the dev branch of D7, but D7 EOL soon. Last D7 issue here!

Status: Fixed » Closed (fixed)

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