diff --git includes/form.inc includes/form.inc
index 6c4757f..6190951 100644
--- includes/form.inc
+++ includes/form.inc
@@ -163,7 +163,7 @@
  *   Any additional arguments are passed on to the functions called by
  *   drupal_get_form(), including the unique form constructor function. For
  *   example, the node_edit form requires that a node object is passed in here
- *   when it is called. These are available to implementations of 
+ *   when it is called. These are available to implementations of
  *   hook_form_alter() and hook_form_FORM_ID_alter() as the array
  *   $form_state['build_info']['args'].
  *
@@ -1423,12 +1423,15 @@ function form_set_error($name = NULL, $message = '', $limit_validation_errors =
       // valid.
       $record = FALSE;
       foreach ($sections as $section) {
-        // Exploding by '][' reconstructs the element's #parents. If the
-        // reconstructed #parents begin with the same keys as the specified
-        // section, then the element's values are within the part of
-        // $form_state['values'] that the clicked button requires to be valid,
-        // so errors for this element must be recorded.
-        if (array_slice(explode('][', $name), 0, count($section)) === $section) {
+        // The element's name reflects its #parents hierarchy. We build a
+        // similar string reflecting the $section array. If this string is an
+        // exact prefix of the element's name, then the element's values are
+        // within the part of $form_state['values'] that the clicked button
+        // requires to be valid, so errors for this element must be recorded.
+        // Comparing strings rather than arrays correctly handles the case of
+        // $section including numeric indexes.
+        $section_string = implode('][', $section);
+        if (strpos($name, $section_string) === 0) {
           $record = TRUE;
           break;
         }
diff --git modules/simpletest/tests/form.test modules/simpletest/tests/form.test
index 661fef9..94e3367 100644
--- modules/simpletest/tests/form.test
+++ modules/simpletest/tests/form.test
@@ -461,16 +461,24 @@ class FormValidationTestCase extends DrupalWebTestCase {
    * Tests partial form validation through #limit_validation_errors.
    */
   function testValidateLimitErrors() {
-    $edit = array('test' => 'invalid');
+    $edit = array('test' => 'invalid', 'test_numeric_index[0]' => 'invalid');
     $path = 'form-test/limit-validation-errors';
 
-    // Submit the form by pressing the button with #limit_validation_errors and
-    // ensure that the title field is not validated, but the #element_validate
-    // handler for the 'test' field is triggered.
+    // Submit the form by pressing the 'Partial validate' button (uses
+    // #limit_validation_errors) and ensure that the title field is not
+    // validated, but the #element_validate handler for the 'test' field
+    // is triggered.
     $this->drupalPost($path, $edit, t('Partial validate'));
     $this->assertNoText(t('!name field is required.', array('!name' => 'Title')));
     $this->assertText('Test element is invalid');
 
+    // Edge case of #limit_validation_errors containing numeric indexes: same
+    // thing with the 'Partial validate (numeric index)' button and the
+    // 'test_numeric_index' field.
+    $this->drupalPost($path, $edit, t('Partial validate (numeric index)'));
+    $this->assertNoText(t('!name field is required.', array('!name' => 'Title')));
+    $this->assertText('Test (numeric index) element is invalid');
+
     // Ensure not validated values are not available to submit handlers.
     $this->drupalPost($path, array('title' => '', 'test' => 'valid'), t('Partial validate'));
     $this->assertText('Only validated values appear in the form values.');
diff --git modules/simpletest/tests/form_test.module modules/simpletest/tests/form_test.module
index 3ae8f65..46757dc 100644
--- modules/simpletest/tests/form_test.module
+++ modules/simpletest/tests/form_test.module
@@ -312,16 +312,33 @@ function form_test_limit_validation_errors_form($form, &$form_state) {
     '#title' => 'Title',
     '#required' => TRUE,
   );
+
   $form['test'] = array(
+    '#title' => 'Test',
+    '#type' => 'textfield',
+    '#element_validate' => array('form_test_limit_validation_errors_element_validate_test'),
+  );
+  $form['test_numeric_index'] = array(
+    '#tree' => TRUE,
+  );
+  $form['test_numeric_index'][0] = array(
+    '#title' => 'Test (numeric index)',
     '#type' => 'textfield',
     '#element_validate' => array('form_test_limit_validation_errors_element_validate_test'),
   );
+
   $form['actions']['partial'] = array(
     '#type' => 'submit',
     '#limit_validation_errors' => array(array('test')),
     '#submit' => array('form_test_limit_validation_errors_form_partial_submit'),
     '#value' => t('Partial validate'),
   );
+  $form['actions']['partial_numeric_index'] = array(
+    '#type' => 'submit',
+    '#limit_validation_errors' => array(array('test_numeric_index', 0)),
+    '#submit' => array('form_test_limit_validation_errors_form_partial_submit'),
+    '#value' => t('Partial validate (numeric index)'),
+  );
   $form['actions']['full'] = array(
     '#type' => 'submit',
     '#value' => t('Full validate'),
@@ -334,7 +351,7 @@ function form_test_limit_validation_errors_form($form, &$form_state) {
  */
 function form_test_limit_validation_errors_element_validate_test(&$element, &$form_state) {
   if ($element['#value'] == 'invalid') {
-    form_error($element, 'Test element is invalid');
+    form_error($element, t('@label element is invalid', array('@label' => $element['#title'])));
   }
 }
 
