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

Unable to open mythweb if mythmusic has never been used #83

Closed
TownCube opened this issue May 16, 2022 · 2 comments
Closed

Unable to open mythweb if mythmusic has never been used #83

TownCube opened this issue May 16, 2022 · 2 comments

Comments

@TownCube
Copy link

The PHP docs report:

As of PHP 8.1.0, the default setting is MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. Previously, it was MYSQLI_REPORT_OFF.

This is breaking MythWeb from starting if you don't use mythmusic as the init check now throws this:

PHP Fatal error:  Uncaught mysqli_sql_exception: Table 'mythconverg.music_songs' doesn't exist in
 /usr/share/mythweb/classes/Database/Query/mysqlicompat.php:68
Stack trace:
#0 /usr/share/mythweb/classes/Database/Query/mysqlicompat.php(68): mysqli_query()
#1 /usr/share/mythweb/classes/Database.php(263): Database_Query_mysqlicompat->execute()
#2 /usr/share/mythweb/classes/Database.php(326): Database->query()
#3 /usr/share/mythweb/modules/music/init.php(15): Database->query_col()
#4 /usr/share/mythweb/classes/Modules.php(30): require_once('...')
#5 /usr/share/mythweb/classes/Modules.php(50): Modules::load()
#6 /usr/share/mythweb/mythweb.php(30): Modules::getModule()

Initially I was thinking you could switch to looking up if the table existed in the information_schema which would solve these checks in the init modules however it wouldn't solve this case where the user's custom SQL needs to be attempted and the result reported back.

Options:

  1. Restore previous behaviour by running mysqli_report(MYSQLI_REPORT_OFF); somewhere high up (eg. on connect)
  2. Add try...catch around the mysqli_query call and handle based on the $db->fatal_errors setting
  3. Remove the enable/disable fatal_errors functionality completely and handle the exceptions locally as required.

Happy to help with a pull request once an option is decided on,

@mymatenige
Copy link
Contributor

@stuarta I've created a quick-n-dirty pull request to keep MythWeb working with PHP 8.1.0. Any chance that it can be reviewed and merged?

@mymatenige
Copy link
Contributor

This can now be closed as the pull request has been merged.

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