matomo
matomo copied to clipboard
[Bug] \Piwik\Archive\ArchiveInvalidator::removeInvalidationsSafely says idSites can be int, but that's not completely accurate
What happened?
I noticed that custom reports were archiving even after being deleted. Debugging, I ended up finding that if a single site ID is passed as the idSites argument, the removeInvalidationsFromDistributedList
method doesn't handle it properly because of a TypeError on line 690.
What should happen?
Since the comment block says that int is an allowed type for idSites, the removeInvalidationsFromDistributedList
should handle that as well, or the removeInvalidationsSafely
method should wrap it with an array before passing isSites on to removeInvalidationsFromDistributedList
.
How can this be reproduced?
Using CustomReports 5.0.17 or earlier do the following:
- Create a new report
- Note that the option record named ReArchiveList was updated to add the newly created report
- Delete the newly created report
- Note that the option record named ReArchiveList was not updated
- Note that archiving is done for the deleted report the next time archiving runs
Matomo version
5.x-dev
PHP version
8.1.30
Server operating system
Ubuntu 22.04
What browsers are you seeing the problem on?
Not applicable (e.g. an API call etc.)
Computer operating system
Ubuntu 22.04
Relevant log output
No response
Validations
- [X] Read our Contributing Guidelines.
- [X] Follow our Security Policy.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- [X] The provided steps to reproduce is a minimal reproducible of the Bug.