Issues

ZF-8622: Zend_Form_Element::setDecorators() can't set what getDecorators() returned

Issue Type: Sub-task Created: 2009-12-23T06:18:18.000+0000 Last Updated: 2010-06-19T10:44:24.000+0000 Status: Resolved Fix version(s): - 1.10.6 (22/Jun/10)

Reporter: Francesco M. (fmntf) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments: - decorators.html

Description

If I do:

$dec = $this->getDecorators(); $this->setDecorators($dec); $dec2 = $this->getDecorators();

var_dump($dec); echo "--------"; var_dump($dec2);

I loose a decorator (see attachment)

Comments

Posted by Francesco M. (fmntf) on 2009-12-23T14:50:37.000+0000

created controller action testcase

Posted by Francesco M. (fmntf) on 2010-01-02T16:30:40.000+0000

anyone here?

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-01-02T16:37:58.000+0000

Please note that it's been holidays for a lot of people the past few weeks, meaning that they either did not work, or worked less. Besides that, unfortunately this issue isn't the only issue out there :'(

If you don't feel like waiting, you could create a patch, preferably with unittests. By doing so, you greatly improve the chances of getting it fixed soon.

Posted by Francesco M. (fmntf) on 2010-01-03T04:56:51.000+0000

Sorry but how could I create a patch for this if I didn't even get a response like "I confirm it's a bug"?

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-03T12:22:16.000+0000

@Francesco: create a reproduce case, and document expected and actual results. Ideally, capture the reproduce case as a unit test.

Posted by Francesco M. (fmntf) on 2010-01-04T05:53:01.000+0000

Mattew: I created a reproduce case. It's attached as 'testcase.php'.

What I need to do is get element decorators and set what i got. The wrong result is that if you get decorators again, you read something different. Actual results are in 'decorators.html', where I dumped what I expected and what I got.

Posted by Christian Albrecht (alab) on 2010-03-16T04:22:14.000+0000

<pre class="highlight">
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
-               $this->addDecorator($decoratorInfo);
+               $this->addDecorator(array(key($decorators) => $decoratorInfo));
+               next($decorators);

Posted by Christian Albrecht (alab) on 2010-03-16T05:29:23.000+0000

But my last solution could lead to problems when calling addDecorators multiple times with nonassociative arrays, so

<pre class="highlight">
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
+               if (!is_numeric($name = key($decorators)) {
+                   $this->addDecorator(array($name => $decoratorInfo));
+               } else {
=                   $this->addDecorator($decoratorInfo);
+               }
+               next($decorators);

Posted by Christian Albrecht (alab) on 2010-06-19T10:44:24.000+0000

Fixed in r22464 and merged into 1.10 release branch

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

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

Contacts