ZF-10199: CLONE -getOption not working with uppercase $key

Description


    public function getOption($key)
    {
        if ($this->hasOption($key)) {
            $options = $this->getOptions();
            $options = array_change_key_case($options, CASE_LOWER);
            return $options[strtolower($key)];
        }
        return null;
    }

hasOption() is case sensitve so it never gets to the strtolowerpart

2 possible solutions:

make getOption() like this:


    public function getOption($key)
    {
       $key = strtolower($key);
        if ($this->hasOption($key)) {
            $options = $this->getOptions();
            $options = array_change_key_case($options, CASE_LOWER);
            return $options[$key];
        }
        return null;
    }

Or make hasOption, since all options get loaded into lowercase keys anyway:


    public function hasOption($key)
    {
        return in_array(strtolower($key), $this->_optionKeys);
    }

Comments

How can this be resolved if it is still not fixed in 1.10.6? :S Please take a look into this and write a test or something so it won't appear again :)

Fixed in trunk r22664, applied r22665 to 1.10 branch.