diff --git a/core/lib/Drupal/Component/Utility/diffArray.php b/core/lib/Drupal/Component/Utility/diffArray.php
new file mode 100644
index 0000000..d374e10
--- /dev/null
+++ b/core/lib/Drupal/Component/Utility/diffArray.php
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\Component\Utility\diffArray.
+ */
+
+namespace Drupal\Component\Utility;
+
+/**
+ * Provides helpers to perform diffs on multi dimensional arrays.
+ */
+class diffArray {
+
+  /**
+   * Computes the difference between arrays.
+   *
+   * This is a PHP 5.4 safe version of array_diff_assoc().
+   *
+   * @param array $array1
+   *   The array to compare from.
+   * @param array $array2
+   *   The array to compare to.
+   *
+   * @return array
+   *   Returns an array containing all the values from array1 that are not present
+   *   in array2.
+   */
+  public static function diffAssoc(array $array1, array $array2) {
+    $difference = array();
+
+    foreach ($array1 as $key => $value) {
+      if (!array_key_exists($key, $array2) || $array2[$key] !== $value) {
+        $difference[$key] = $value;
+      }
+    }
+
+    return $difference;
+  }
+
+  /**
+   * Recursively computes the difference of arrays with additional index check.
+   *
+   * This is a version of array_diff_assoc() that supports multidimensional
+   * arrays.
+   *
+   * @param array $array1
+   *   The array to compare from.
+   * @param array $array2
+   *   The array to compare to.
+   *
+   * @return array
+   *   Returns an array containing all the values from array1 that are not present
+   *   in array2.
+   */
+  public static function diffAssocRecursive(array $array1, array $array2) {
+    $difference = array();
+
+    foreach ($array1 as $key => $value) {
+      if (is_array($value)) {
+        if (!array_key_exists($key, $array2) && !is_array($array2[$key])) {
+          $difference[$key] = $value;
+        }
+        else {
+          $new_diff = static::diffAssocRecursive($value, $array2[$key]);
+          if (!empty($new_diff)) {
+            $difference[$key] = $new_diff;
+          }
+        }
+      }
+      elseif (!array_key_exists($key, $array2) || $array2[$key] !== $value) {
+        $difference[$key] = $value;
+      }
+    }
+
+    return $difference;
+  }
+
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/diffArrayUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/diffArrayUnitTest.php
new file mode 100644
index 0000000..a983955
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/diffArrayUnitTest.php
@@ -0,0 +1,92 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\Common\diffArrayUnitTest.
+ */
+
+namespace Drupal\system\Tests\Common;
+
+use Drupal\Component\Utility\diffArray;
+use Drupal\simpletest\UnitTestBase;
+
+/**
+ * Tests the diffArray helper class.
+ */
+class diffArrayUnitTest extends UnitTestBase {
+
+  /**
+   * Array to use for testing.
+   *
+   * @var array
+   */
+  protected $array1;
+
+  /**
+   * Array to use for testing.
+   *
+   * @var array
+   */
+  protected $array2;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'diffArray functionality',
+      'description' => 'Tests the diffArray helper class.',
+      'group' => 'System',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+
+    $this->array1 = array(
+      'same' => 'yes',
+      'different' => 'no',
+      'array_empty_diff' => array(),
+      'null' => NULL,
+      'int_diff' => 1,
+      'array_diff' => array('same' => 'same', 'array' => array('same' => 'same')),
+      'new' => 'new',
+    );
+    $this->array2 = array(
+      'same' => 'yes',
+      'different' => 'yes',
+      'array_empty_diff' => array(),
+      'null' => NULL,
+      'int_diff' => '1',
+      'array_diff' => array('same' => 'different', 'array' => array('same' => 'same')),
+    );
+  }
+
+  /**
+   * Tests diffArray::diffAssoc().
+   */
+  public function testDiffAssoc() {
+    $expected = array(
+      'different' => 'no',
+      'int_diff' => 1,
+      // The whole value will be copied.
+      'array_diff' => array('same' => 'same', 'array' => array('same' => 'same')),
+      'new' => 'new',
+    );
+
+    $this->assertIdentical(diffArray::diffAssoc($this->array1, $this->array2), $expected);
+  }
+
+  /**
+   * Tests diffArray::diffAssocRecursive().
+   */
+  public function testDiffAssocRecursive() {
+    $expected = array(
+      'different' => 'no',
+      'int_diff' => 1,
+      // The 'array' key should no be returned as it's the same.
+      'array_diff' => array('same' => 'same'),
+      'new' => 'new',
+    );
+
+    $this->assertIdentical(diffArray::diffAssocRecursive($this->array1, $this->array2), $expected);
+  }
+
+}
