When zero is used as a valid choice in the "Available options" of an integer select list the edit form fails to find a default value and instead loads the empty option (-Select a value-). The "0" is stored correctly, the widget fails to load the value on the edit form.
Here's an example of options that fail:
0|No idea - I do not know them
40|They have some experience
60|They are very experienced
80|They are a professional
In the select_or_other.field_widget.inc line 156 the#default_value is calculated by calling !empty() which returns false for a zero value. If we instead use isset() a zero value will be correctly handled.
For my use case with zero (0) values this works. Switching to isset() for strings seems to have no impact on the current behavior.
Testing with on a text field with the following available options:
Resulted in the "empty" value being selected on edit no matter if it was "empty" (empty string) or null "- Select a value - " selected using either the existing !empty() or isset().
Attaching patch in a moment. Needs review.