diff --git a/changelog.md b/changelog.md index eaee9eb..d1ec7f6 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ### All notable changes to `CRM CLient V2` will be documented in this file. # version 3.0.1 +- Fixed : WPCrm bootSessionIfNeeded trying to access $_SESSION['wpcrm'] before session was started - Fixed : WPCrm now only returns a boolean - Fixed : get crm info when client used in laravel - Changed : WpCrm::makeApiV2Call Change LogLevel on error from Emerge to Critical diff --git a/src/WordPress/WPCrm.php b/src/WordPress/WPCrm.php index 9ffe37a..9c4601a 100644 --- a/src/WordPress/WPCrm.php +++ b/src/WordPress/WPCrm.php @@ -465,12 +465,12 @@ class WPCrm self::$sessionKey = ($_SERVER['HTTP_USER_AGENT'] ?? '') . ($_SERVER['REMOTE_ADDR'] ?? ''); /** @var string self::$sessionKey */ self::$sessionKey = \strlen(self::$sessionKey) ? self::$sessionKey : (date('d') ? date('d') : ''); - if (!isset($_SESSION['wpcrm'])) { - $_SESSION['wpcrm'] = []; - } if (!session_id() && !self::$sessionDestroyed) { session_start(); } + if (!isset($_SESSION['wpcrm'])) { + $_SESSION['wpcrm'] = []; + } if ( // If session identity is violated. count($_SESSION['wpcrm']) > 1 or