ZF-7902: Zend_Filter_StringTrim does not work when trim string is '/'

Issue Type: Bug Created: 2009-09-20T19:26:28.000+0000 Last Updated: 2010-03-11T10:28:54.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Coen Hyde (coenhyde) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: - ZF-8782

Attachments: - StringTrim.php.diff


Zend_Filter_StringTrim no longer works (i just upgraded from 1.7.3) when the string you wish to trim is '/'.

I get this warning and Zend_Filter_StringTrim::filter returns 0 Warning: preg_replace() [function.preg-replace]: Unknown modifier ']' in Zend/Filter/StringTrim.php on line 112

How to replicate: $stringTrim = new Zend_Filter_StringTrim('/'); $stringTrim->filter('/some/uri/here/');


Posted by Christian Wenz (wenz) on 2009-09-24T01:34:18.000+0000

The issue is caused by the forward slash also being the delimiter in the regular expression used. I've prepared a patch that escapes the forward slash properly.

Posted by Christian Wenz (wenz) on 2009-09-24T01:52:33.000+0000

Patch for ZF-7902

Posted by Christian Wenz (wenz) on 2009-09-24T01:54:43.000+0000

(sorry for the duplicate upload, but got a stacktrace on the first try. deleting one of the files.)

Posted by Thomas Weidner (thomas) on 2009-09-24T13:59:26.000+0000

Fixed with r18399. Thnx for the patch.

Posted by Coen Hyde (coenhyde) on 2010-01-12T02:00:14.000+0000

This issue still present in version 1.9.7

Posted by Thomas Weidner (thomas) on 2010-01-12T03:54:05.000+0000

This issue is marked as fixed for the next minor release which is 1.10. Otherwise "Fix-Version" would point to a defined release where this issue has been solved.

Posted by Christian Wenz (wenz) on 2010-03-11T10:28:54.000+0000

IMHO the test case for this issue does not check for the bug reported here. Attaching a changed test case.

Have you found an issue?

See the Overview section for more details.


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

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