Patch to start PHP session only when needed
-
This is a follow up to https://wordpress.org/support/topic/php-session-always-started-even-when-not-needed/ since that topic is no longer allowing new replies.
The following changes to classes/wp_cassify_plugin.php is one minimal way to make the PHP session only start when actually needed.
Update wp_cassify_session_start() as follows, with the changes in bold:
public function wp_cassify_session_start( $force = false ) { if ( $force || isset( $_COOKIE[ session_name() ] ) ) { if(! session_id() ) { session_start(); } } }
And then update wp_cassify_grab_service_ticket() as follows, again with the changes in bold:
if ( (! is_user_logged_in() ) || (! is_user_member_of_blog() ) ) { if (! empty( $service_ticket ) ) { // Ensure session is started $this->wp_cassify_session_start( true ); // Retrieve configuration options from database
Note that I’ve only done rudimentary verification of these changes, but it seems to work as expected.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Patch to start PHP session only when needed’ is closed to new replies.