When creating an integer list field,
if you manually add keys that have leading zeros,
then the keys get stored as strings and the data is not properly displayed.
The saved values on the content that are stored in the database are fine however.
To reproduce:
- Add a new integer list field to a content type
- Manually add keys for example
01|Jan
02|Feb
03|March - Save the field and note that there are no validation errors.
- Create a new piece of content and fill in a value for this field.
- View the content and note that the key is displayed but not the value.
- Edit the content and note that the proper value is not automatically set.
This is due to the fact that the leading zero passes is_numeric validation and passes a regex checking to ensure that all characters are numeric. But PHP typecasts this as a string. We can simply fix this with the patch attached in the comment.