-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Description
Laravel Version
12.32.5
PHP Version
8.3.27
Database Driver & Version
MySQL Server version: 8.0.44-0ubuntu0.24.04.1 (Ubuntu)
Description
When attempting to create a session and receiving an SQL error, the framework ignores the error and tries to update the session.
This makes it difficult to identify errors (I just experienced this).
This happens on line 154 of the src/Illuminate/Session/DatabaseSessionHandler.php file.
This seems redundant since the write() method checks if the session exists or not, determining whether to create or update it.
I ran into this problem because I was having trouble validating the CSRF token.
I was able to make the request (/sanctum/csrf-token), receive the cookies correctly, but kept getting error 419 when using the token.
When I checked the session table, I saw that there were no records. That's when I found the problem.
Steps To Reproduce
- Create a new application.
- Configure the session driver as a database.
- Create any column as mandatory in the migration of the sessions table.
- Try to use the session.
- You will notice that the record in the
sessionstable will not be created and there will also be no errors.