Skip to content

Commit

Permalink
Avoid PHP warning if error_get_last() is null
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Aug 8, 2023
1 parent 5f189be commit 9d6615e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ public function start(array $customOptions = []) : bool
throw new LogicException('Session was already active');
}
if ( ! @\session_start($this->getOptions($customOptions))) {
$message = '';
if (\error_get_last()) {
$message = ': ' . \error_get_last()['message'];
}
throw new RuntimeException(
'Session could not be started: ' . \error_get_last()['message']
'Session could not be started' . $message
);
}
$time = \time();
Expand Down

0 comments on commit 9d6615e

Please sign in to comment.