diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bfe1e8a..95f7733a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1086,8 +1086,10 @@ Previously, in PHP 8, values like `'0'` or `'false'` could be incorrectly interp Now, default values are accurately converted to `TRUE` or `FALSE` based on their literal meaning. +Berikut adalah versi yang sudah diperbarui untuk catatan rilis MagicObject v3.16.0: -## MagicObject Version 3.15.0 + +## MagicObject Version 3.16.0 ### Features @@ -1097,3 +1099,12 @@ Added a new method `deleteRecordByPrimaryKey($primaryKeyValue)` to allow deletin This method ensures the database connection is active and delegates deletion to the persistence layer. + +### Bug Fixes + +#### Fix: Session Handling with Redis + +Resolved a compatibility issue when using Redis as the PHP session handler. Previously, sessions could fail to initialize or persist correctly under certain configurations. + +Now, session storage works reliably with `session.save_handler = redis`, ensuring better support for scalable session storage backends. + diff --git a/src/Session/PicoSession.php b/src/Session/PicoSession.php index 3430f371..48afdda7 100644 --- a/src/Session/PicoSession.php +++ b/src/Session/PicoSession.php @@ -61,10 +61,17 @@ public function __construct($sessConf = null) $this->setSessionMaxLifeTime($sessConf->getMaxLifeTime()); } if ($sessConf && $sessConf->getSaveHandler() == "redis") { - $path = $sessConf->getSaveHandler(); - $parsed = parse_url($path); - parse_str($parsed['query'], $parsedStr); - $this->saveToRedis($parsed['host'], $parsed['port'], $parsedStr['auth']); + $path = $sessConf->getSavePath(); + $parsed = parse_url($path); + $host = isset($parsed['host']) ? $parsed['host'] : ''; + $port = isset($parsed['port']) ? $parsed['port'] : 0; + $auth = null; + if(isset($parsed['query'])) + { + parse_str($parsed['query'], $parsedStr); + $auth = isset($parsedStr['auth']) ? $parsedStr['auth'] : null; + } + $this->saveToRedis($host, $port, $auth); } elseif ($sessConf && $sessConf->getSaveHandler() == "files" && $sessConf->getSavePath() != "") { $this->saveToFiles($sessConf->getSavePath()); }