Zend Framework

Zend_Filter_StringTrim does not work when trim string is '/'

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.9.7
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Filter
  • Labels:
    None

Description

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/');

  1. StringTrim.php.diff
    24/Sep/09 1:52 AM
    0.5 kB
    Christian Wenz
  2. StringTrimTest.php.diff
    11/Mar/10 10:28 AM
    0.4 kB
    Christian Wenz

Issue Links

Activity

Hide
Christian Wenz added a comment -

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.

Show
Christian Wenz added a comment - 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.
Hide
Christian Wenz added a comment -

Patch for ZF-7902

Show
Christian Wenz added a comment - Patch for ZF-7902
Hide
Christian Wenz added a comment -

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

Show
Christian Wenz added a comment - (sorry for the duplicate upload, but got a stacktrace on the first try. deleting one of the files.)
Hide
Thomas Weidner added a comment -

Fixed with r18399.
Thnx for the patch.

Show
Thomas Weidner added a comment - Fixed with r18399. Thnx for the patch.
Hide
Coen Hyde added a comment -

This issue still present in version 1.9.7

Show
Coen Hyde added a comment - This issue still present in version 1.9.7
Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Christian Wenz added a comment -

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

Show
Christian Wenz added a comment - IMHO the test case for this issue does not check for the bug reported here. Attaching a changed test case.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: