Repository navigation
ext/dba/tests: sort expected test output - #14962
Merged
Merged
Conversation
Iterating through a database with firstkey() and nextkey() is guaranteed to retrieve all rows, but apparently not in any particular order. This is causing a test failure for at least one user, so we steal the sort() approach from GDBM to ensure that the output is predictable.
The actual output is now sorted for consistency, so we need to update the expected output as well. As a nice side effect, some differences in the expected outputs for the various engines have been eliminated. Closes phpGH-14786
cmb69
reviewed
Jul 15, 2024
Member
Windows won't (only QDBM and LMDB are tested on CI, currently). I haven't checked other OSs. |
This test uses a routine from ext/dba that now sorts its (actual) output, so we have to sort the expected output here as well.
Girgias
approved these changes
Jul 16, 2024
Girgias
left a comment
Member
There was a problem hiding this comment.
LGTM, we probably should backport this
After doing some more digging, it looks like GDBM isn't the only engine where the iteration order with firstkey() and nextkey() might change unexpectedly.
Contributor
Author
|
Thanks, I added one more commit to clarify the comment. |
Member
|
Alpine hit the sorting issue too: #16902 (comment) |
Member
|
Yeah probably should |
Member
|
OK. I'll get to it, I'll make a PR soon and if that passes CI merge it. |
ndossche
pushed a commit
to ndossche/php-src
that referenced
this pull request
Nov 26, 2024
Alpine CI regularly fails because of the sorting order of these tests. See php#14962 (comment)
ndossche
pushed a commit
that referenced
this pull request
Nov 26, 2024
Alpine CI regularly fails because of the sorting order of these tests. See #14962 (comment) Closes GH-16950.
ndossche
added a commit
that referenced
this pull request
Nov 26, 2024
* PHP-8.2: Backport GH-14962 to stable versions
ndossche
added a commit
that referenced
this pull request
Nov 26, 2024
* PHP-8.3: Backport GH-14962 to stable versions
ndossche
added a commit
that referenced
this pull request
Nov 26, 2024
* PHP-8.4: Backport GH-14962 to stable versions
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 #14786 by sorting the fetched rows before
echoing them, and updating the expected output to reflect the sort order.I don't have dbm, ndbm, or Oracle db < 4 to test so hopefully the CI does.