Zend Framework

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

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.6
  • Fix Version/s: 1.10.6
  • Component/s: Zend_Form
  • Labels:
    None

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)

  1. decorators.html
    23/Dec/09 6:18 AM
    7 kB
    Francesco M.
  2. testcase.php
    23/Dec/09 2:50 PM
    0.8 kB
    Francesco M.

Activity

Hide
Francesco M. added a comment -

created controller action testcase

Show
Francesco M. added a comment - created controller action testcase
Hide
Francesco M. added a comment -

anyone here?

Show
Francesco M. added a comment - anyone here?
Hide
Dolf Schimmel (Freeaqingme) added a comment -

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.

Show
Dolf Schimmel (Freeaqingme) added a comment - 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.
Hide
Francesco M. added a comment -

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"?

Show
Francesco M. added a comment - 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"?
Hide
Matthew Weier O'Phinney added a comment -

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

Show
Matthew Weier O'Phinney added a comment - @Francesco: create a reproduce case, and document expected and actual results. Ideally, capture the reproduce case as a unit test.
Hide
Francesco M. added a comment -

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.

Show
Francesco M. added a comment - 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.
Hide
Christian Albrecht added a comment -
Zend_Form_Element::addDecorators()
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
-               $this->addDecorator($decoratorInfo);
+               $this->addDecorator(array(key($decorators) => $decoratorInfo));
+               next($decorators);
Show
Christian Albrecht added a comment -
Zend_Form_Element::addDecorators()
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
-               $this->addDecorator($decoratorInfo);
+               $this->addDecorator(array(key($decorators) => $decoratorInfo));
+               next($decorators);
Hide
Christian Albrecht added a comment -

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

Zend_Form_Element::addDecorators()
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
+               if (!is_numeric($name = key($decorators)) {
+                   $this->addDecorator(array($name => $decoratorInfo));
+               } else {
=                   $this->addDecorator($decoratorInfo);
+               }
+               next($decorators);
Show
Christian Albrecht added a comment - But my last solution could lead to problems when calling addDecorators multiple times with nonassociative arrays, so
Zend_Form_Element::addDecorators()
=           } elseif ($decoratorInfo instanceof Zend_Form_Decorator_Interface) {
+               if (!is_numeric($name = key($decorators)) {
+                   $this->addDecorator(array($name => $decoratorInfo));
+               } else {
=                   $this->addDecorator($decoratorInfo);
+               }
+               next($decorators);
Hide
Christian Albrecht added a comment -

Fixed in r22464 and merged into 1.10 release branch

Show
Christian Albrecht added a comment - Fixed in r22464 and merged into 1.10 release branch

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: