Issues

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

Issue Type: Bug Created: 2011-07-28T07:16:04.000+0000 Last Updated: 2012-07-09T15:31:33.000+0000 Status: Resolved Fix version(s): Reporter: Shahar Evron (shahar) Assignee: Thomas Weidner (thomas) Tags: - Zend\I18n

  • zf-crteam-padraic
  • zf-crteam-priority

Related issues: Attachments: - ZF2-45-naive-fix.patch

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:

<pre class="highlight">
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

Posted by Shahar Evron (shahar) on 2011-07-28T07:35:39.000+0000

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

Posted by Thomas Weidner (thomas) on 2011-07-30T12:06:50.000+0000

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

Posted by Thomas Weidner (thomas) on 2011-08-30T19:26:52.000+0000

Fixed with GH-358

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts