Skip to content

Commit

Permalink
Added check on session_status before calling session_start
Browse files Browse the repository at this point in the history
  • Loading branch information
gadiener authored Sep 14, 2018
1 parent 55f7413 commit ca4798f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ static public function start($name=null){
// Obfuscate IDs
ini_set('session.hash_function', 'whirlpool');
session_cache_limiter('must-revalidate');
@session_start();
if (session_status() == PHP_SESSION_NONE) {
@session_start();
}
static::trigger("start", $name?:$ln);
}

Expand Down

2 comments on commit ca4798f

@lastguest
Copy link
Member

@lastguest lastguest commented on ca4798f Sep 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gadiener Why? The error notice is already suppressed by the @ operator.

As of PHP 4.3.3, calling session_start() after the session was previously started will result in an error of level E_NOTICE. Also, the second session start will simply be ignored.

@gadiener
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lastguest While using the @ operator, if you have set up a custom error handling function with set_error_handler(), the error handler will still be called. if you're using an automatic error reporter (like Sentry) this can report unexpected errors.

Please sign in to comment.