ZF2-338: FormSelect options with int values

Description

Hi there,


$id_sexe = new Element('id_sexe');
$id_sexe->setAttributes(array(
'type' => 'select'
'label' => 'gender',
'options' => array('man'=>1,'woman'=>2) 
));

Doesn't generate correct output because values are "int" types. So maybe i should cast into string all values or change the following code :

https://github.com/zendframework/zf2/…

David

Comments

My vote would be for changing the FormSelect code, changing that line to allow for other primitive types... something like:


if (is_string($optionSpec) || is_numeric($optionSpec) || is_bool($optionSpec)) {

Sent a fix that allows all scalar values to be able to be used as option values