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
Posted by Sandi Verdev (sverde1) on 2010-07-21T14:05:30.000+0000
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 :)
Posted by Ramon Henrique Ornelas (ramon) on 2010-07-24T17:42:54.000+0000
Fixed in trunk r22664, applied r22665 to 1.10 branch.