ZF-2538: Zend_Filter_Inflector::filter() fails with all numeric folder on Windows
Description
Hi,
I think we've found a bug in Zend_Filter_Inflector::filter() when using Windows and a module directory that contains a folder consisting entirely of numbers.
The problem manifests itself on line 150 of Inflector.php:
$inflectedTarget = preg_replace(array_keys($processedParts), array_values($processedParts), $this->_target);
In our case input data is: $processedParts: array(2) { ["#:suffix#"] => "phtml" ["#:moduleDir#"] => "D:\htdocs\HEAD\24074\app\modules\default" }
$this->_target : ":moduleDir/views"
And the result is:
$inflectedTarget: "D:\htdocs\HEAD074\app\modules\default/views"
If we use a module dir of "D:/htdocs/HEAD/24074/app/modules" then the problem goes away. Similarly a module dir of "D:\htdocs\HEAD\a24074\app\modules\default" also works.
Note that it doesn't matter what the number is, in all cases, the first two digits, along with the precending backslash are removed. I suspect it's related to preg_replace's parameter substitution.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-02-04T15:30:02.000+0000
Assigning to Ralph
Posted by Miroslav Kubelik (koubel) on 2008-02-05T02:07:18.000+0000
Yes, I found the same problem, simple workaround is (tested only on windows)
Posted by Ralph Schindler (ralph) on 2008-02-15T11:20:33.000+0000
FIxed in r8036.
Added str_replace() to disable possible backreference like syntax inside replacement strings.
-ralph