ZF-5937: disableTranslator option in Zend_Form_Element_Multi makes the options disappear

Description

When the disableTranslator flag is true on a multi options element, new options added with the addMultiOption method are never really added to the options stack.

Here is the patch I made. I have not signed the CLA for the moment but I give you this patch without any restriction.

/**
 * Translate an option
 *
 * @param  string $option
 * @param  string $value
 * @return bool
 */
protected function _translateOption($option, $value)
{
    if ($this->translatorIsDisabled()) {
        return false;
    }

    if (!isset($this->_translated[$option]) && !empty($value)) {
        $trValue = $this->_translateValue($value);
        if ($trValue === $value) {
            return false;
        }
        $this->options[$option] = $trValue;
        $this->_translated[$option] = true;
        return true;
    }

    return false;
}

Comments

Corrected file

Just to clarify: _translateOption returns TRUE when the translator is disabled, while it should return FALSE.

All that needs changing is:


        if ($this->translatorIsDisabled()) {
            return true;
        }

into


        if ($this->translatorIsDisabled()) {
            return false;
        }

Created patch for issue and provided phpunit test.

Patch from Mike Willbanks applied in trunk and 1.8 release branch -- thanks!