Skip to content

Commit

Permalink
Update SessionSavePath()
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Sep 10, 2023
1 parent dedfc6c commit 2dae9e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/AdapterFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function session_name(string $name = ''): string
* @param string $path
* @return string
*/
function session_save_path(string $path = ''): string
function session_save_path(?string $path = null): string|false
{
return Http::sessionSavePath($path);
}
Expand Down
14 changes: 10 additions & 4 deletions src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,20 @@ public static function sessionName(string $name = null): string

/**
* Get and/or set the current session save path.
*
* @see https://www.php.net/manual/en/function.session-save-path.php
*/
public static function sessionSavePath(string $path = null): string
public static function sessionSavePath(?string $path = null): string|false
{
if ($path && \is_dir($path) && \is_writable($path) && ! static::sessionStarted()) {
static::$sessionSavePath = $path;
if ($path === null) {
return static::$sessionSavePath;
}

return static::$sessionSavePath;
if (! static::sessionStarted() && \is_dir($path) && \is_writable($path)) {
return static::$sessionSavePath = $path;
}

return false;
}

/**
Expand Down

0 comments on commit 2dae9e7

Please sign in to comment.