Maskedinput With Optional Characters Fails On Update

I’ve got a pretty standard Zip Code field using MaskedInput like this:


                    $form->field($model, 'zip_code')->widget(

                         MaskedInput::className(), [

                             'mask' => '99999?-9999',



That works just fine on create, but on update, the field displays [font="Courier New"]77027?-3955[/font] (instead of 77027-3955, which is what is stored in the database) with an error message stating: Zip Code should contain at most 10 characters.

The question mark, on update, is fixed in the field, just like the literal characters in a mask. I cannot be deleted. Consequently, there is no way to update the field. This behavior is totally different from when there is no data in that field in which case the widget works just fine.

Am I doing something wrong, or is this a bug?