From f4315d8ba4a13b14e31b48ff65c4f0f7c9cbca56 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Wed, 17 Jan 2018 02:30:04 +0900 Subject: [PATCH] When the PHP version is 7.2 or higher `ini_set('session.save_handler', 'user')` can't be executed, so delete. --- lib/Cake/Model/Datasource/CakeSession.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 8e9429b53..fec94fcf3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -552,6 +552,12 @@ class CakeSession { if (!empty($sessionConfig['handler'])) { $sessionConfig['ini']['session.save_handler'] = 'user'; + + // In PHP7.2.0+ session.save_handler can't be set to 'user' by the user. + // https://github.com/php/php-src/commit/a93a51c3bf4ea1638ce0adc4a899cb93531b9f0d + if (version_compare(PHP_VERSION, '7.2.0', '>=')) { + unset($sessionConfig['ini']['session.save_handler']); + } } elseif (!empty($sessionConfig['session.save_path']) && Configure::read('debug')) { if (!is_dir($sessionConfig['session.save_path'])) { mkdir($sessionConfig['session.save_path'], 0775, true);