Skip to content

"session_set_save_handler(): Cannot change save handler when headers already sent" on CRON runsΒ #89

@bluestarstudios

Description

@bluestarstudios

@ericmann Thanks for an incredible plugin. Following up on issue #81. It looks like the latest version still throws the same warning.

The plugin throws a warning session_set_save_handler(): Cannot change save handler when headers already sent on every single cron run which is called via wget on our server. Here's the stack trace:

in EAMann\Sessionz\Manager::initialize called at /wp-content/plugins/wp-session-manager/wp-session-manager.php (49)
in wp_session_manager_initialize called at /wp-includes/class-wp-hook.php (301)
in WP_Hook::apply_filters called at /wp-includes/class-wp-hook.php (327)
in WP_Hook::do_action called at /wp-includes/plugin.php (470)
in do_action called at /wp-settings.php (441)
in require_once called at /wp-config.php (18)
in require_once called at /wp-load.php (50)
in require_once called at /wp-cron.php (44)

Looking through the code, in version 4.2.0 you made sure that session_start() doesn't run when DOING_CRON is defined. Which is great. However, maybe add_action('plugins_loaded', 'wp_session_manager_initialize', 1, 0); should be wrapped in the same logic? session_set_save_handler($manager); on line 133 in /wp-session-manager/vendor/ericmann/sessionz/php/Manager.php is the cause for the issue.

We're running PHP 7.4.30 via fpm-fcgi, WordPress 5.8.3, and WP Session Manager 4.2.0.

Let me know how I can help in further debugging this and getting a fix pushed.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions