librenms / librenms-agent

LibreNMS Agent & Scripts
GNU General Public License v2.0
117 stars 188 forks source link

run_query PHP 8.1 fix #430

Closed oszafraniec closed 1 year ago

oszafraniec commented 1 year ago

https://www.php.net/manual/en/mysqli-driver.report-mode.php As of PHP 8.1.0, the default setting is MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. Previously, it was MYSQLI_REPORT_OFF.

Before the fix on PHP 8.1 and MariaDB 10.6.7 the script will fail with an error like this:

PHP Fatal error:  Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NONBLOCKING' at line 1 in /etc/snmp/mysql:1313
Stack trace:
#0 /etc/snmp/mysql(1313): mysqli_query()
#1 /etc/snmp/mysql(422): run_query()
#2 /etc/snmp/mysql(141): ss_get_mysql_stats()
#3 {main}
  thrown in /etc/snmp/mysql on line 1313
CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.