Issues

ZF2-43: Zend\Translator tests fail because of unescaped regex

Description

This looks like a regression that was introduced in commit 8e34a0ea0f33ca, now in master branch.

It seems that the pattern used to create the RegexIterator is not being escaped properly, so for example if $ignore is '/.' (which is probably the most common value), the regex will be '//./u' which is invalid.

This breaks the tests, and I get for example:


37) ZendTest\Translator\TranslatorTest::testSettingLogPriorityForLog
InvalidArgumentException: RecursiveRegexIterator::__construct(): Unknown modifier '.'

/Users/shahar/Code/zf2/library/Zend/Translator/Adapter.php:271
/Users/shahar/Code/zf2/library/Zend/Translator/Adapter.php:179
/Users/shahar/Code/zf2/library/Zend/Translator/Adapter/Csv.php:70
/Users/shahar/Code/zf2/library/Zend/Translator/Translator.php:145
/Users/shahar/Code/zf2/library/Zend/Translator/Translator.php:94
/Users/shahar/Code/zf2/tests/Zend/Translator/TranslatorTest.php:859

Comments

This is a naive attempt to fix the problem that works for me. Hopefully it is good enough.

This patch breaks 36 tests in my environment. It seems to be a Win-nix problem.

Fixed with GH-358