Fixed : WPCrm bootSessionIfNeeded trying to access $_SESSION['wpcrm'] before session was started

This commit is contained in:
Jérémy Munsch 2022-02-11 13:07:14 +01:00
parent 3ac734dbae
commit 7e6efc7d4e
No known key found for this signature in database
GPG key ID: 55196BEE445F6049
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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