Fixed pagination bug#2231
Merged
Merged
Conversation
jessevz
approved these changes
Jun 16, 2026
Member
|
As this is a change to the DBA core, can you please write at least one phpunit test which tests such a case? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #2208
Details:
When the hashlists get ordered on another column than the id (e.g. cracked or name) and the second page gets called, a CORS error happens. This is due to the response including a previously silenced warning:
The malformed/incorrectly made SQL query is (see the last part with "Hashlist.format NOT IN ('Array'))"):
SELECT Hashlist.hashlistId AS Hashlist_hashlistId, Hashlist.hashlistName AS Hashlist_hashlistName, Hashlist.format AS Hashlist_format, Hashlist.hashTypeId AS Hashlist_hashTypeId, Hashlist.hashCount AS Hashlist_hashCount, Hashlist.saltSeparator AS Hashlist_saltSeparator, Hashlist.cracked AS Hashlist_cracked, Hashlist.isSecret AS Hashlist_isSecret, Hashlist.hexSalt AS Hashlist_hexSalt, Hashlist.isSalted AS Hashlist_isSalted, Hashlist.accessGroupId AS Hashlist_accessGroupId, Hashlist.notes AS Hashlist_notes, Hashlist.brainId AS Hashlist_brainId, Hashlist.brainFeatures AS Hashlist_brainFeatures, Hashlist.isArchived AS Hashlist_isArchived FROM Hashlist WHERE Hashlist.accessGroupId IN ('1') AND Hashlist.isArchived='0' AND Hashlist.format NOT IN ('3') AND (Hashlist.cracked>'0') OR (Hashlist.cracked='0' AND Hashlist.hashlistId>'5' AND Hashlist.isArchived='0' AND Hashlist.format NOT IN ('Array')) ORDER BY Hashlist.cracked ASC, Hashlist.hashlistId ASC LIMIT 5This happens because the hashlist.format ContainFilter in the PaginationFilter used to create this query doesn't contain a single int but an int in an array:
This is due to the applyFilters function in the AbstractModelFactory not being able to handle array that are more nested than two levels. I used a recursive function to handle it so it also doesn't happen in other cases with deeper nested arrays.