From 29ca1f78928c8c842cc3d145f12eec24ad0e0194 Mon Sep 17 00:00:00 2001 From: Jeff Chan Date: Wed, 12 Feb 2014 03:07:27 +0000 Subject: [PATCH] Use stable sort for removeProperty of OptionsPropertyGroup. The original custom sort function is not stable, which causes different results on HHVM. It now uses the default array_diff function which is stable. Also updated an incorrect test. Signed-off-by: Jeff Chan --- .../properties/options/OptionsPropertyGroup.class.php | 7 ++----- .../properties/options/PMA_OptionsPropertyGroup_test.php | 9 --------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/libraries/properties/options/OptionsPropertyGroup.class.php b/libraries/properties/options/OptionsPropertyGroup.class.php index fe2fe40f65..0e4ed357af 100644 --- a/libraries/properties/options/OptionsPropertyGroup.class.php +++ b/libraries/properties/options/OptionsPropertyGroup.class.php @@ -56,12 +56,9 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem */ public function removeProperty($property) { - $this->_properties = array_udiff( + $this->_properties = array_diff( $this->getProperties(), - array($property), - function ($a, $b) { - return ($a === $b ) ? 0 : 1; - } + array($property) ); } diff --git a/test/classes/properties/options/PMA_OptionsPropertyGroup_test.php b/test/classes/properties/options/PMA_OptionsPropertyGroup_test.php index 7e4ebcb702..2566d21c19 100644 --- a/test/classes/properties/options/PMA_OptionsPropertyGroup_test.php +++ b/test/classes/properties/options/PMA_OptionsPropertyGroup_test.php @@ -71,15 +71,6 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase $properties = new \ReflectionProperty('OptionsPropertyGroup', '_properties'); $properties->setAccessible(true); - $properties->setValue($this->stub, array(1, 2, 3, 'test')); - - $this->stub->removeProperty('test'); - - $this->assertEquals( - array(1, 2, 3, 'test'), - $properties->getValue($this->stub) - ); - $properties->setValue($this->stub, array(1, 2, 'test', 3)); $this->stub->removeProperty('test');