diff --git a/core/includes/form.inc b/core/includes/form.inc
index 49ace44..7e9c1e6 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -2155,7 +2155,7 @@ function _form_button_was_clicked($element, &$form_state) {
   // coordinates of the click on the button image. This means that image
   // buttons MUST have unique $form['#name'] values, but the details of
   // their $_POST data should be ignored.
-  elseif (!empty($element['#has_garbage_value']) && isset($element['#value']) && $element['#value'] !== '') {
+  elseif (!empty($element['#has_garbage_value']) && isset($form_state['input'][$element['#name'] . '_x']) && isset($form_state['input'][$element['#name'] . '_y'])) {
     return TRUE;
   }
   return FALSE;
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index 03b7cb8..8feed17 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -2097,6 +2097,7 @@ function form_test_clicked_button($form, &$form_state) {
       // Image buttons need a #src; the others need a #value.
       if ($type == 'image_button') {
         $form[$name]['#src'] = 'core/misc/druplicon.png';
+        $form[$name]['#value'] = $name;
       }
       else {
         $form[$name]['#value'] = $name;
