Skip to content

Commit

Permalink
Ensure sessions are enabled
Browse files Browse the repository at this point in the history
Disable the initialization routine if sessions are disabled.

Fixes #79
  • Loading branch information
ericmann committed Feb 16, 2019
1 parent ee85c61 commit b969bc0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Changelog

**4.1.1**
- Fix: Defensively protect deprecated functions with `function_exists()` checks to avoid conflicts with other systems.
- Fix: Disable the initialization routine if sessions are disabled.

**4.1.0**
- Fix: Add some defense to ensure end users are running the correct version of PHP before loading the system.
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ None

= 4.1.1 =
* Fix: Defensively protect deprecated functions with `function_exists()` checks to avoid conflicts with other systems.
- Fix: Disable the initialization routine if sessions are disabled.

= 4.1.0 =
* Fix: Add some defense to ensure end users are running the correct version of PHP before loading the system.
Expand Down
5 changes: 2 additions & 3 deletions wp-session-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ function wp_session_manager_start_session()
if (version_compare(PHP_VERSION, WP_SESSION_MINIMUM_PHP_VERSION, '<')) {
add_action('admin_notices', 'wp_session_manager_deactivated_notice');
} else {
add_action('plugins_loaded', 'wp_session_manager_initialize', 1, 0);

// Start up session management, if we're not in the CLI.
if (!defined('WP_CLI') || false === WP_CLI) {
if (session_status() !== PHP_SESSION_DISABLED && (!defined('WP_CLI') || false === WP_CLI)) {
add_action('plugins_loaded', 'wp_session_manager_initialize', 1, 0);
add_action('plugins_loaded', 'wp_session_manager_start_session', 10, 0);
}
}

0 comments on commit b969bc0

Please sign in to comment.