diff --git a/core/modules/options/options.module b/core/modules/options/options.module
index dbe02e8..2f60c6e 100644
--- a/core/modules/options/options.module
+++ b/core/modules/options/options.module
@@ -188,6 +188,15 @@ function options_field_settings_form_validate_allowed_values($element, &$form_st
         form_error($element, t('Allowed values list: each key must be a string at most 255 characters long.'));
         break;
       }
+      // PHP has problems with typecasting. We've passed other validation so now
+      // make sure we have actual integer keys and not strings if this is an
+      // integer list. To do this we have to remove the old keys and replace
+      // them with specific typecast keys.
+      if ($field_type == 'list_integer') {
+        unset($values[$key]);
+        $key = (int) $key;
+        $values[$key] = $value;
+      }
     }
 
     // Prevent removing values currently in use.
