Updated: Comment #N
Problem/Motivation
This is part of #2165377: [meta] HHVM compatibility
fetchBaseTables is supposed to return its results ordered by weight and then title. Internally, it uses uasort, which according to PHP's documentation is not stable.
The test case in HEAD has got 4 elements with equal weight, but 2 elements with equal titles AND weight. The order for both elements are thus undefined after uasort. However, the test case assumes that the order is preserved.
Proposed resolution
This patch will change the comparison of the array keys to check for the proper order of the array instead of specifically checking the keys of the array for equality.
Remaining tasks
User interface changes
API changes
Original report by @lowjoel
fetchBaseTables is supposed to return its results ordered by weight and then title. Internally, it uses uasort, which according to PHP's documentation is not stable.
The test case in HEAD has got 4 elements with equal weight, but 2 elements with equal titles AND weight. The order for both elements are thus undefined after uasort. However, the test case assumes that the order is preserved.
This patch will change the comparison of the array keys to check for the proper order of the array instead of specifically checking the keys of the array for equality.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | drupal-fix-array-order-checking-2191533-5-D8.patch | 1.15 KB | berdir |
| #3 | drupal-fix-array-order-checking-2191533-3-D8.patch | 1.16 KB | lowjoel |
| #1 | drupal-fix-array-order-checking-2191533-1-D8.patch | 1.15 KB | lowjoel |
Comments
Comment #1
lowjoel commentedUpload patch v1
Comment #2
dawehnerGood catch!
we chould better use spaces instead of tabs.
Comment #3
lowjoel commentedWoops, editorfail.
Comment #4
jibranComment #5
berdirAlmost perfect, we use two spaces instead of 4. Here's a fix.
Confirmed this locally on HHVM, the test is passing again.
I'm apparently currently unable to compile the latest version (master) of HHVM due to the following error:
So I can't verify if the other tests (I currently have two failing tests with my version) are fixed but even if they weren't, it would be a separate issue.
Also updated the issue summary.
Comment #6
catchCommitted/pushed to 8.x, thanks!