Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9.2
-
Fix Version/s: 1.9.3
-
Component/s: Zend_Application
-
Labels:None
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); }
This is related to
ZF-6679Basically, the intention was that getOptions would preserve the original case, but lookups (getOption and hasOption) would work if you supply a lowercase key or a case sensitive key.
But, passing a key with a capital letter does not work.
ZF-6679Basically, the intention was that getOptions would preserve the original case, but lookups (getOption and hasOption) would work if you supply a lowercase key or a case sensitive key. But, passing a key with a capital letter does not work.