Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom error handler crashes when session is invalid #1809

Open
ghalse opened this issue May 23, 2023 · 1 comment
Open

Custom error handler crashes when session is invalid #1809

ghalse opened this issue May 23, 2023 · 1 comment

Comments

@ghalse
Copy link
Contributor

ghalse commented May 23, 2023

Describe the bug

The custom error handlers throw an exception when there is no valid session. This results in a fatal error, early enough to cause PHP to display a blank 500 error to end users.

To Reproduce

Throw any unhandled exception before the creation of a valid session.

For example, the exception thrown by unserialize() when trying to read an existing 1.19.x session will reliably trigger this.

Expected behavior

A helpful error message to be displayed to the user :-)

This probably requires a transient session to be created by the handler if there isn't a valid one.

Screenshots or logs

AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Typed property SimpleSAML\\Session::$trackid must not be accessed before initialization in /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Session.php:552
Stack trace:
#0 /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Session.php(399): SimpleSAML\\Session->getTrackID()
#1 /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Session.php(281): SimpleSAML\\Session::load()
#2 /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Error/Error.php(191): SimpleSAML\\Session::getSessionFromRequest()
#3 /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Error/Error.php(229): SimpleSAML\\Error\\Error->saveError()
#4 /home/safire/simplesamlphp-2.0.3/public/_include.php(32): SimpleSAML\\Error\\Error->show()
#5 [internal function]: SimpleSAML_exception_handler()
#6 {main}
thrown in /home/safire/simplesamlphp-2.0.3/src/SimpleSAML/Session.php on line 552`
@Eagle-Admin
Copy link

Eagle-Admin commented Oct 2, 2023

We're seeing the exact same behaviour in our enviroment.

[02-Oct-2023 15:33:07 Europe/City] PHP Fatal error: Uncaught Error: Typed property SimpleSAML\Session::$trackid must not be accessed before initialization in C:\inetpub\wwwroot\simplesamlphp_azuread\src\SimpleSAML\Session.php:552 Stack trace: #0 C:\inetpub\wwwroot\simplesamlphp_azuread\src\SimpleSAML\Session.php(399): SimpleSAML\Session->getTrackID() #1 C:\inetpub\wwwroot\simplesamlphp_azuread\src\SimpleSAML\Session.php(281): SimpleSAML\Session::load() #2 C:\inetpub\wwwroot\simplesamlphp_azuread\src\SimpleSAML\Auth\Simple.php(52): SimpleSAML\Session::getSessionFromRequest() #3 C:\inetpub\wwwroot\[sanitized]\login2.php(47): SimpleSAML\Auth\Simple->__construct() #4 {main} thrown in C:\inetpub\wwwroot\simplesamlphp_azuread\src\SimpleSAML\Session.php on line 552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants