Skip to content

Tags: opensourcepos/opensourcepos

Tags

unstable

Toggle unstable's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: Catch mysqli_sql_exception in DB fallback handlers for fresh Doc…

…ker installs (#4525)

* fix: Catch mysqli_sql_exception in DB fallback handlers for fresh Docker installs

On a fresh Docker install with an empty database, the ospos_sessions
table doesn't exist yet. The CSRF filter triggers session initialization
before the login/migration page can be reached.

The existing code in Session.php, OSPOS.php, and MY_Migration.php
catches DatabaseException, but the MySQLi driver throws
mysqli_sql_exception (which extends RuntimeException, not
DatabaseException) when the table doesn't exist. This causes an
unhandled exception resulting in HTTP 500.

Fix: Change all three catch blocks from  to
 so that mysqli_sql_exception and any other unexpected
database errors are caught, allowing the app to fall back gracefully:

- Session.php: Falls back to FileHandler so sessions work without DB
- OSPOS.php: Falls back to empty settings so config loads work
- MY_Migration.php: Falls back to version 0 / false so the migration
  check passes gracefully

This allows the login page with migration UI to be served on first
access, so the initial schema migration can run.

Fixes #4524
---------

Co-authored-by: Ollama <[email protected]>

3.4.1

Toggle 3.4.1's commit message
Set release version to 3.4.1

3.4.0

Toggle 3.4.0's commit message
Update install instructions + remove build on tag

3.3.9

Toggle 3.3.9's commit message
Update npm package secret

3.3.8

Toggle 3.3.8's commit message
Bump to 3.3.8

3.3.7

Toggle 3.3.7's commit message
Add item_pic to escape ignore list (#3379)

3.3.6

Toggle 3.3.6's commit message
Translated using Weblate (Polish)

Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/pl/

master.3.3.6

Toggle master.3.3.6's commit message
Bump to 3.3.6

3.3.5

Toggle 3.3.5's commit message
Blind sql injection fixes (#3284)

master.3.3.5

Toggle master.3.3.5's commit message
Blind sql injection fixes (#3284)