ZF-7443: value $option erased by foreach loop

Description

abstract class Zend_Translate_Adapter { ... public function setOptions(array $options = array()) { $change = false; $locale = null; foreach ($options as $key => $option) { if ($key == 'locale') { $locale = $option; } else if ((isset($this->_options[$key]) and ($this->_options[$key] != $option)) or !isset($this->_options[$key])) { if (($key == 'log') && !($option instanceof Zend_Log)) { require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception('Instance of Zend_Log expected for option log'); }

            $this->_options[$key] = $option;
            $change = true;
        }
    }

    if ($locale !== null) {
        $this->setLocale($option);                                     <------------!!!------------  should be:   $this->setLocale($locale);
    }

    if (isset(self::$_cache) and ($change == true)) {
        $id = 'Zend_Translate_' . $this->toString() . '_Options';
        self::$_cache->save( serialize($this->_options), $id);
    }

    return $this;
}

... }

Comments

Duplicate of already solved issue ZF-7099