Index: library/Zend/Filter/Inflector.php =================================================================== --- library/Zend/Filter/Inflector.php (revision 20756) +++ library/Zend/Filter/Inflector.php (working copy) @@ -73,7 +73,7 @@ */ public function __construct($target = null, Array $rules = array(), $throwTargetExceptionsOn = null, $targetReplacementIdentifer = null) { - if ($target instanceof Zend_Config) { + if ($target instanceof Zend_Config || is_array($target)) { $this->setConfig($target); } else { if ((null !== $target) && is_string($target)) { @@ -124,10 +124,15 @@ * Use Zend_Config object to set object state * * @param Zend_Config $config + * @throws Zend_Filter_Exception * @return Zend_Filter_Inflector */ - public function setConfig(Zend_Config $config) + public function setConfig($config) { + if (!$config instanceof Zend_Config && !is_array($config)) { + throw new Zend_Filter_Exception('Invalid type given, value should be array or object Zend_Config'); + } + foreach ($config as $key => $value) { switch ($key) { case 'target': @@ -137,8 +142,7 @@ if (is_scalar($value)) { break; } - $paths = $value->toArray(); - foreach ($paths as $prefix => $path) { + foreach ($value as $prefix => $path) { $this->addFilterPrefixPath($prefix, $path); } break; @@ -149,7 +153,10 @@ $this->setTargetReplacementIdentifier($value); break; case 'rules': - $this->addRules($value->toArray()); + if ($value instanceof Zend_Config) { + $value = $value->toArray(); + } + $this->addRules($value); break; default: break; @@ -483,6 +490,7 @@ * Resolve named filters and convert them to filter objects. * * @param string $rule + * @throws Zend_Filter_Exception * @return Zend_Filter_Interface */ protected function _getRule($rule) Index: tests/Zend/Filter/InflectorTest.php =================================================================== --- tests/Zend/Filter/InflectorTest.php (revision 20756) +++ tests/Zend/Filter/InflectorTest.php (working copy) @@ -428,6 +428,8 @@ $inflector = new Zend_Filter_Inflector(); $inflector->setConfig($config); $this->_testOptions($inflector); + $inflector->setConfig($this->getOptions()); + $this->_testOptions($inflector); } /**