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

MySQLi syntax error "AND idarchive < ?' at line 3" #16978

Closed
MichaIng opened this issue Dec 18, 2020 · 1 comment · Fixed by #16988
Closed

MySQLi syntax error "AND idarchive < ?' at line 3" #16978

MichaIng opened this issue Dec 18, 2020 · 1 comment · Fixed by #16988
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@MichaIng
Copy link
Contributor

MichaIng commented Dec 18, 2020

I upgraded Matomo to the first beta of 4.1.0 and sadly as well migrated to PHP8.0, so I'm not quite sure which one of both is responsible for the error messages I get now:

ERROR | Piwik\ExceptionHandler | 2020-12-17 23:16:12 UTC | bd4c8 | AND idarchive < ?' at line 3
ERROR | Piwik\ExceptionHandler | 2020-12-17 23:16:12 UTC | bd4c8 | Mysqli prepare error: 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 'AND idarchive >= ?
ERROR | Piwik\ExceptionHandler | 2020-12-17 23:16:12 UTC | bd4c8 | AND idarchive < ?' at line 3
ERROR | Piwik\ExceptionHandler | 2020-12-17 23:16:12 UTC | bd4c8 | Uncaught exception: /var/www/matomo/libs/Zend/Db/Statement/Mysqli.php(77): Mysqli prepare error: 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 'AND idarchive >= ?

Copied from logs viewer, hence first entry is the most recent one.

Apache2 reports it as well:

Dec 18 21:20:59 dietpi.com apache2[2133626]: [proxy_fcgi:error] [pid 2133626:tid 140713454954240] [client 162.158.202.249:19486] AH01071: Got error 'PHP message: Error in Matomo: Mysqli prepare error: 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 &#039;AND idarchive &gt;= ?                   AND idarchive &lt; ?&#039; at line 3', referer: https://dietpi.com/
matomo/index.php?module=PrivacyManager&action=privacySettings&idSite=1&period=range&date=last7&limit=100

It happens when accessing Administration > Privacy > Anonymize data.

But it seems to have a larger rats tail, as since then as well archiving data does not work anymore and reports are not generated. Running the archive cron job also shows:

INFO [2020-12-18 21:07:02] 3374105  SUMMARY
INFO [2020-12-18 21:07:02] 3374105  Processed 0 archives.
INFO [2020-12-18 21:07:02] 3374105  Total API requests: 0

EDIT: That part has been fixed with #16968, hence is not related to the syntax error.

It is likely those functions: https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/PrivacyManager/ReportsPurger.php#L259-L284
I guess one of the variables that should replace the ? is not set correctly, but I do not 100% understand what happens there 😉.

@MichaIng MichaIng mentioned this issue Dec 18, 2020
9 tasks
@tsteur
Copy link
Member

tsteur commented Dec 20, 2020

It looks like I can reproduce this @MichaIng and will create a PR. It's hard to say by which query it is caused but 99% chance it's caused by the one we will adjust.

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Dec 20, 2020
@tsteur tsteur added this to the 4.1.0 milestone Dec 20, 2020
@mattab mattab changed the title [4.1.0-b1][PHP8.0] MySQLi syntax erro "AND idarchive < ?' at line 3" MySQLi syntax error "AND idarchive < ?' at line 3" Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants