Support » Plugin: WP Session Manager » Multiple sessions error

  • Resolved therealgilles

    (@chamois_blanc)


    Hello,

    I am seeing this error on admin screens:

    Another plugin is attempting to start a session with WordPress. WP Session Manager will not work!

    When I look at $_SESSION when the error is triggered, it exists but is empty. Should the plugin check whether it’s actually being used for something before giving up?

    How do I track down what other plugin is using it?

    PS: This error is new, right?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Eric Mann

    (@ericmann)

    Yes, this error message is new.

    WP Session Manager attempts to replace the session handler used by PHP when it stores data. If the session has already been started, then PHP doesn’t allow the plugin to replace the session handler at all. With older versions of PHP, this just failed silently. As of PHP 7.2 it’s become a formal warning and is often exposed directly on the site when encountered.

    See https://wordpress.org/support/topic/php-7-2-warning-5/ for the original report that led to the fix.

    Said another way: If your site is showing this error, then it means WP Session Manager was never really working on your site to begin with because another system would set up the session first.

    Regardless of whether or not you’ve actually populated the session, merely calling session_start() before WP Session Manager loads will block the PHP from loading or using the custom session handler.

    How do I track down what other plugin is using it?

    Do a scan of the plugins (and your theme!) on your site and look for session_start(). Whichever code is calling that is likely doing so outside of the plugins_loaded hook and is beating WP Session Manager to the punch.

    • This reply was modified 8 months ago by  Eric Mann. Reason: Fix formatting
    • This reply was modified 8 months ago by  Eric Mann. Reason: Fix HTML formatting that was broken before :-(
    therealgilles

    (@chamois_blanc)

    Is the only real fix to change the order plugins are loaded to make sure WP Session Manager is loaded earlier?

    Plugin Author Eric Mann

    (@ericmann)

    Plugins are loaded in order based on their name. So wp-session-manager will get loaded after aardvark-fancy-plugin because of where they fall in the alphabet. Plugins should leverage the plugins_loaded hook to ensure they’re only triggering business logic once everything’s been pulled into the environment.

    Some plugin (or even the theme) is calling session_start() outside of this hook and running too early.

    therealgilles

    (@chamois_blanc)

    It looks like it may come from the Custom Sidebars plugin. Let me contact the author.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple sessions error’ is closed to new replies.