In Zend PHP, order in the result output of usort() function is undefined, if two items has the same key value. Therefore, this means that JArrayHelper::sortObjects can return two items with the same key in any order as it uses usort() in its implementation. However, testSortObjects() assumes that usort() is always consistent, which is not guaranteed and at least not in the case of HHVM.
This patch will make testSortObjects() works in both Zend and HHVM PHP implementations.
Whilst travis didn't complete. The 5.4 test did complete and shows several tests are now not passing because of this change. Could you please update this so the tests pass? Thanks :)
I'm getting errors too on my local PHP 5.4.10 setup, but they're all Array to string conversion messages (the same issue the Travis build has on the PHP 5.4 run), which isn't necessarily the code having issues at this point but rather how the tests are handling that. I retriggered the Travis job to try and get a proper PHP 5.3 test, but right now I'm still seeing the output from the first run which is useless in trying to see why that environment is failing but @chalet16 isn't having issues.
We merged 0504b70 from @mbabker which should have fixed this in a way that keeps our PHP implementations happy! Thankyou for submitting this code though - it's really appreciated
Whilst travis didn't complete. The 5.4 test did complete and shows several tests are now not passing because of this change. Could you please update this so the tests pass? Thanks :)