diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
index 8793db2..36c453b 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
@@ -65,6 +65,10 @@ function testOptionsAllowedValuesInteger() {
     $string = "0|Zero\n2|Two";
     $array = array('0' => 'Zero', '2' => 'Two');
     $this->assertAllowedValuesInput($string, $array, 'Integer keys are accepted.');
+    // Add keys that have leading zeros and verify that are not stored as strings.
+    $string = "00|Zero\n02|Two";
+    $array = array('00' => 'Zero', '02' => 'Two');
+    $this->assertAllowedValuesInput($string, $array, 'Keys that have leading zeros are not stored as strings.');
     // Check that values can be added and removed.
     $string = "0|Zero\n1|One";
     $array = array('0' => 'Zero', '1' => 'One');
@@ -296,6 +300,11 @@ function assertAllowedValuesInput($input_string, $result, $message) {
     else {
       field_info_cache_clear();
       $field = field_info_field('node', $this->field_name);
+      // Keys are stored as integers, so for the key "00" the stored key should be 0.
+      if ($this->field_name == 'field_options_integer' && !isset($result[0])) {
+        $this->assertNotIdentical($field->getSetting('allowed_values'), $result, $message);
+        return;
+      }
       $this->assertIdentical($field->getSetting('allowed_values'), $result, $message);
     }
   }
diff --git a/core/modules/options/options.module b/core/modules/options/options.module
index 44ce6b7..cc93eac 100644
--- a/core/modules/options/options.module
+++ b/core/modules/options/options.module
@@ -188,6 +188,13 @@ function options_field_settings_form_validate_allowed_values($element, &$form_st
         form_error($element, $form_state, t('Allowed values list: each key must be a string at most 255 characters long.'));
         break;
       }
+      // Integer list keys that have leading zeros should not be stored as strings
+      // (i.e. "01" must be stored as 1).
+      if ($field_type == 'list_integer') {
+        unset($values[$key]);
+        $key = (int) $key;
+        $values[$key] = $value;
+      }
     }
 
     // Prevent removing values currently in use.
