Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.1
-
Fix Version/s: 1.5.3
-
Component/s: Zend_Filter_Inflector
-
Labels:None
-
Fix Version Priority:Must Have
Description
Sample:
$bla = new Zend_Filter_Inflector('abc');
$bla->addRules(array(':xys'=>array()));
echo $bla->filter (array('xy'=>'ab'));
This causes a php-error
Notice: /Zend/Zend/Filter/Inflector.php line 451 - Undefined variable: processedParts Debug Warning: /Zend/Zend/Filter/Inflector.php line 451 - array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array Notice: /Zend/Zend/Filter/Inflector.php line 451 - Undefined variable: processedParts Debug Warning: /Zend/Zend/Filter/Inflector.php line 451 - array_values() [<a href='function.array-values'>function.array-values</a>]: The argument should be an array Debug Warning: /Zend/Zend/Filter/Inflector.php line 451 - preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Empty regular expression
I had a look at line 451
$inflectedTarget = preg_replace(array_keys($processedParts), array_values($processedParts), $this->_target);
and when I debug it, it seems to me, that the array processedParts doesnt exists, if there are no replacements to do (see first notice "undefined variable"). In the example above there is a rule and there is something in filter(), but they dont match. The most simple example is this
$bla = new Zend_Filter_Inflector('');
var_dump($bla->filter (array()));
The array is never initialized. The file revision is 8226 (trunk).
Fixed in trunk in r9045.
Lemme know if that fixes it..
-ralph