diff --git a/core/includes/common.inc b/core/includes/common.inc
index 61b63be..9d08c12 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1,6 +1,7 @@
 <?php
 
 use Drupal\Component\Utility\Crypt;
+use Drupal\Component\Utility\SortArray;
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\Component\Utility\UrlValidator;
@@ -5180,14 +5181,12 @@ function element_info_property($type, $property_name, $default = NULL) {
  *   element, a default value of 0 will be used.
  * @param $b
  *   Second item for comparison.
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortWeight()
+ *
  */
-function drupal_sort_weight($a, $b) {
-  $a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['weight'])) ? $b['weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+function drupal_sort_weight(array $a, array $b) {
+  return SortArray::sortWeight($a, $b);
 }
 
 /**
@@ -5695,7 +5694,7 @@ function drupal_get_updaters() {
   if (!isset($updaters)) {
     $updaters = module_invoke_all('updater_info');
     drupal_alter('updater_info', $updaters);
-    uasort($updaters, 'drupal_sort_weight');
+    uasort($updaters, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
   }
   return $updaters;
 }
@@ -5715,7 +5714,7 @@ function drupal_get_filetransfer_info() {
   if (!isset($info)) {
     $info = module_invoke_all('filetransfer_info');
     drupal_alter('filetransfer_info', $info);
-    uasort($info, 'drupal_sort_weight');
+    uasort($info, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
   }
   return $info;
 }
diff --git a/core/includes/update.inc b/core/includes/update.inc
index 3659caf..e4962a3 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -1033,7 +1033,7 @@ function update_resolve_dependencies($starting_updates) {
   // Perform the depth-first search and sort on the results.
   $graph_object = new Graph($graph);
   $graph = $graph_object->searchAndSort();
-  uasort($graph, 'drupal_sort_weight');
+  uasort($graph, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
 
   foreach ($graph as $function => &$data) {
     $module = $data['module'];
diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php
new file mode 100644
index 0000000..7556307
--- /dev/null
+++ b/core/lib/Drupal/Component/Utility/SortArray.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Component\Utility\SortArray.
+ */
+
+namespace Drupal\Component\Utility;
+
+/**
+ * Provides generic array sorting helper methods.
+ */
+class SortArray {
+
+  /**
+   * Sorts a structured array by the 'weight' element.
+   *
+   * Note that the sorting is by the 'weight' array element, not by the render
+   * element property '#weight'.
+   *
+   * Callback for uasort() used in various functions.
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative
+   *   arrays that optionally include a 'weight' element. For items without a
+   *   'weight' element, a default value of 0 will be used.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public static function sortWeight(array $a, array $b) {
+    $a_weight = isset($a['weight']) ? $a['weight'] : 0;
+    $b_weight = isset($b['weight']) ? $b['weight'] : 0;
+    if ($a_weight === $b_weight) {
+      return 0;
+    }
+    return ($a_weight < $b_weight) ? -1 : 1;
+  }
+}
diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php
index 1ebab9e..eb7de8e 100644
--- a/core/lib/Drupal/Core/Entity/EntityListController.php
+++ b/core/lib/Drupal/Core/Entity/EntityListController.php
@@ -166,7 +166,7 @@ public function buildOperations(EntityInterface $entity) {
     // Retrieve and sort operations.
     $operations = $this->getOperations($entity);
     $this->moduleHandler->alter('entity_operation', $operations, $entity);
-    uasort($operations, 'drupal_sort_weight');
+    uasort($operations, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
     $build = array(
       '#type' => 'operations',
       '#links' => $operations,
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
index 7917731..789162f 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
@@ -75,7 +75,7 @@ function testList() {
 
     $actual_operations = $controller->getOperations($entity);
     // Sort the operations to normalize link order.
-    uasort($actual_operations, 'drupal_sort_weight');
+    uasort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
     $this->assertIdentical($expected_operations, $actual_operations);
 
     // Test buildHeader() method.
@@ -148,7 +148,7 @@ function testList() {
 
     $actual_operations = $controller->getOperations($entity);
     // Sort the operations to normalize link order.
-    uasort($actual_operations, 'drupal_sort_weight');
+    uasort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
     $this->assertIdentical($expected_operations, $actual_operations);
   }
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
index d51544d..109882a 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
@@ -57,7 +57,7 @@ public function getInstance(array $options) {
     $selection_handler_groups = $this->getSelectionGroups($target_entity_type);
 
     // Sort the selection plugins by weight and select the best match.
-    uasort($selection_handler_groups[$selection_handler], 'drupal_sort_weight');
+    uasort($selection_handler_groups[$selection_handler], array('Drupal\Component\Utility\SortArray', 'sortWeight'));
     end($selection_handler_groups[$selection_handler]);
     $plugin_id = key($selection_handler_groups[$selection_handler]);
 
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
index 6f22fa8..7fdbbed 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
@@ -143,7 +143,7 @@ public function getOptions($field_type = NULL) {
       $options = array();
       $field_types = field_info_field_types();
       $widget_types = $this->getDefinitions();
-      uasort($widget_types, 'drupal_sort_weight');
+      uasort($widget_types, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
       foreach ($widget_types as $name => $widget_type) {
         foreach ($widget_type['field_types'] as $widget_field_type) {
           // Check that the field type exists.
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php
index ecf8de4..65621d9 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php
@@ -217,7 +217,7 @@ public function reduceOrder($array, $a) {
       $array[] = $a['name'];
     }
     if (!empty($a['children'])) {
-      uasort($a['children'], 'drupal_sort_weight');
+      uasort($a['children'], array('Drupal\Component\Utility\SortArray', 'sortWeight'));
       $array = array_merge($array, array_reduce($a['children'], array($this, 'reduceOrder')));
     }
     return $array;
diff --git a/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php b/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php
index 3f35f5b..6555768 100644
--- a/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php
+++ b/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php
@@ -27,7 +27,7 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
           $style->effects[$ieid] = $effect;
         }
         // Sort effects by weight.
-        uasort($style->effects, 'drupal_sort_weight');
+        uasort($style->effects, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
       }
     }
     parent::attachLoad($queried_entities, $revision_id);
diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
index adaf260..32f6b42 100644
--- a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
+++ b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
@@ -118,7 +118,7 @@ protected function sortBlocks() {
     }
 
     foreach ($regions as $region_name => &$blocks) {
-      uasort($blocks, 'drupal_sort_weight');
+      uasort($blocks, array('Drupal\Component\Utility\SortArray', 'sortWeight'));
       $this->blocksInRegions[$region_name] = array_keys($blocks);
     }
   }
diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc
index e8bd8e0..1c6fdaf 100644
--- a/core/modules/taxonomy/taxonomy.admin.inc
+++ b/core/modules/taxonomy/taxonomy.admin.inc
@@ -312,7 +312,7 @@ function taxonomy_overview_terms_submit($form, &$form_state) {
   }
 
   // Sort term order based on weight.
-  uasort($form_state['values']['terms'], 'drupal_sort_weight');
+  uasort($form_state['values']['terms'], array('Drupal\Component\Utility\SortArray', 'sortWeight'));
 
   $vocabulary = $form_state['taxonomy']['vocabulary'];
   // Update the current hierarchy type as we go.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
index ec65d2c..5257d33 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
@@ -667,7 +667,7 @@ protected function buildGroupValidate($form, &$form_state) {
    */
   protected function buildGroupSubmit($form, &$form_state) {
     $groups = array();
-    uasort($form_state['values']['options']['group_info']['group_items'], 'drupal_sort_weight');
+    uasort($form_state['values']['options']['group_info']['group_items'], array('Drupal\Component\Utility\SortArray', 'sortWeight'));
     // Filter out removed items.
 
     // Start from 1 to avoid problems with #default_value in the widget.
diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
new file mode 100644
index 0000000..c5b15ff
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
@@ -0,0 +1,105 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Utility\SortArrayTest.
+ */
+
+namespace Drupal\Tests\Component\Utility;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\Component\Utility\SortArray;
+
+/**
+ * Tests the MapArray system.
+ *
+ * @see \Drupal\Component\Utility\SortArray
+ */
+class SortArrayTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'SortArray test',
+      'description' => 'Test that the SortArray functions work properly.',
+      'group' => 'Common',
+    );
+  }
+
+  /**
+   * Tests SortArray::sortWeight() input against expected output.
+   *
+   * @dataProvider providerSortArray
+   *
+   * @param array $a
+   *   The first input array for the SortArray::sortWeight() method.
+   * @param array $b
+   *   The second input array for the SortArray::sortWeight().
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortWeight()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::providerSortArray()
+   */
+  public function testSortArray($a, $b, $expected) {
+    $result = SortArray::sortWeight($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortWeight().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for testSortArray.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortWeight()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortArray()
+   */
+  public function providerSortArray() {
+    $tests = array();
+
+    // Weights set and equal
+    $tests[] = array(
+      array('weight' => 1),
+      array('weight' => 1),
+      0
+    );
+
+    // Weights set and $a is less (lighter) than $b
+    $tests[] = array(
+      array('weight' => 1),
+      array('weight' => 2),
+      -1
+    );
+
+    // Weights set and $a is greater (heavier) than $b
+    $tests[] = array(
+      array('weight' => 2),
+      array('weight' => 1),
+      1
+    );
+
+    // Weights not set
+    $tests[] = array(
+      array(),
+      array(),
+      0
+    );
+
+    // Weights for $b not set
+    $tests[] = array(
+      array('weight' => 1),
+      array(),
+      1
+    );
+
+    // Weights for $a not set
+    $tests[] = array(
+      array(),
+      array('weight' => 1),
+      -1
+    );
+
+    return $tests;
+  }
+
+}
