ZF-10002: Zend_Form_Element_Multi sets the array key instead of the given key when key is like an integer

Issue Type: Bug Created: 2010-06-17T03:06:54.000+0000 Last Updated: 2010-06-30T14:19:37.000+0000 Status: Resolved Fix version(s): Reporter: Maarten Tibau (webtrix) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments:


I'm going to try to explain this the best way I can. I have a form with a combo box.

<pre class="highlight">$list = array(array('key' => '1', 'value' => 'value 1'), 
              array('key' => '22', 'value' => 'value 2'),
              array('key' => 'three', 'value' => 'value 3'));

//myFormConfig.ini = Select = true = MySelect = "Select"

$myForm = new Zend_Form(myFormConfig);


The output I now get is this

<pre class="highlight">//output
value 1value 2value 3

The corrrect output should be

<pre class="highlight">//correct output
value 1value 2value 3

I have searched in the ZF code, in the file Zend/View/Helper/FormSelect.php on line 64 you have the public function formSelect.

When I do a var_dump of the $attribs, I see that the select options that I pass are in this variable and not it the variable $options.

When I change the the code on line 67 to this

//line 67 in Zend/View/Helper/FormSelect.php ```

Everything works OK. I can not find where the options are being set or why my select options aren't set into the $options variable. In ZF version 1.9.7 I don't have this problem.


Posted by Christian Albrecht (alab) on 2010-06-17T12:07:46.000+0000

What happens if you use the correct method for adding the options? Like ```

Posted by Maarten Tibau (webtrix) on 2010-06-17T23:33:11.000+0000

That doesn't have any effect, the result stays the same.

What I did find out is that when I do a vardump of $options variable form the Zend/View/Helper/FormSelect.php file of ZF version 1.9.7. the select options are printed correctly.

I'm going to try to find out where the $options variable is set because I don't think anything has been changed since the introduction of the ZF 1.10 version.

Posted by Maarten Tibau (webtrix) on 2010-06-18T02:47:48.000+0000

I've been searching for a while but I just can't find where it goes wrong. The current solution stays the same as mentioned in the issue.

Posted by Christian Albrecht (alab) on 2010-06-30T14:18:38.000+0000

I am not able to follow you - setOptions is the wrong method for what you want to achieve. Second you are using a custom Decorator Select, maybe there is something wrong with it.

Posted by Christian Albrecht (alab) on 2010-06-30T14:19:37.000+0000

I resolve this issue as i am unable to reproduce.

Have you found an issue?

See the Overview section for more details.


© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.