[ci skip] Proper error handling for Sessions on PHP 5

This was actually a PHP bug, see https://wiki.php.net/rfc/session.user.return-value

Also related: #4039
6 files changed