From 06269b3fba8fd48f3e39fb22e143e9fc8abd1240 Mon Sep 17 00:00:00 2001 From: "andrew.keiper" Date: Wed, 16 Jan 2019 10:43:04 -0500 Subject: [PATCH 1/2] resolving session issues for php 7.2 --- lib/Cake/Model/Datasource/CakeSession.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 45c96e565..75bb703c5 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -575,7 +575,7 @@ class CakeSession { $sessionConfig['cacheLimiter'] = 'must-revalidate'; } - if (empty($_SESSION)) { + if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE && empty($_SESSION)) { if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) { foreach ($sessionConfig['ini'] as $setting => $value) { if (ini_set($setting, $value) === false) { @@ -587,7 +587,7 @@ class CakeSession { if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) { call_user_func_array('session_set_save_handler', $sessionConfig['handler']); } - if (!empty($sessionConfig['handler']['engine'])) { + if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE && !empty($sessionConfig['handler']['engine'])) { $handler = static::_getHandler($sessionConfig['handler']['engine']); session_set_save_handler( array($handler, 'open'), From 38074f72e92243a5290567093cc58a4c6e0d069d Mon Sep 17 00:00:00 2001 From: "andrew.keiper" Date: Wed, 16 Jan 2019 15:28:35 -0500 Subject: [PATCH 2/2] adding support for PHP 5.3 by adding function_exists for session_status --- lib/Cake/Model/Datasource/CakeSession.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 75bb703c5..c8f1db437 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -575,7 +575,7 @@ class CakeSession { $sessionConfig['cacheLimiter'] = 'must-revalidate'; } - if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE && empty($_SESSION)) { + if (empty($_SESSION) && !headers_sent() && (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE)) { if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) { foreach ($sessionConfig['ini'] as $setting => $value) { if (ini_set($setting, $value) === false) { @@ -587,7 +587,7 @@ class CakeSession { if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) { call_user_func_array('session_set_save_handler', $sessionConfig['handler']); } - if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE && !empty($sessionConfig['handler']['engine'])) { + if (!empty($sessionConfig['handler']['engine']) && !headers_sent() && (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE)) { $handler = static::_getHandler($sessionConfig['handler']['engine']); session_set_save_handler( array($handler, 'open'),