When running ctools test suite with php7 we get the following failure.

There was 1 failure:

1) Drupal\Tests\ctools\Unit\VariantCollectionTraitTest::testGetVariantsSort
Failed asserting that Array &0 (
    'foo' => 'foo'
    'bar' => 'bar'
) is identical to Array &0 (
    'bar' => 'bar'
    'foo' => 'foo'
).

Since the plugins created for the variant tests here don't have a weight, they get the "identical" sort behavior. This changed in PHP 7 to not swap the values though[ref]. I think the likely solution is to fall back on sorting by id when there isn't a weight so variants sort consistently in all versions of PHP and identical weighted variants have a logic order.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

neclimdul’s picture

Status: Active » Needs review

  • neclimdul committed c640bba on 8.x-3.x
    Issue #2631342 by neclimdul: Variant sort isn't consistent in PHP 5 and...
neclimdul’s picture

Status: Needs review » Fixed

I think tim gave me the nod that this looked right in IRC so went ahead an pushed it :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.