Skip to content

Commit

Permalink
Merge pull request #12906 from akeiper/2.x
Browse files Browse the repository at this point in the history
resolving ini_set error in php 7.2

Fixes #12678
  • Loading branch information
markstory committed Jan 17, 2019
2 parents a13abcf + 38074f7 commit 73de35c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/Datasource/CakeSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ protected static function _configureSession() {
$sessionConfig['cacheLimiter'] = 'must-revalidate';
}

if (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) {
Expand All @@ -587,7 +587,7 @@ protected static function _configureSession() {
if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) {
call_user_func_array('session_set_save_handler', $sessionConfig['handler']);
}
if (!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'),
Expand Down

0 comments on commit 73de35c

Please sign in to comment.