Zend Framework

Zend_Text_MultiByte::wordWrap() incorrect work

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.6
  • Fix Version/s: 1.7.7
  • Component/s: Zend_Text_Table
  • Labels:
    None

Description

When you try to do something like this:

$line = Zend_Text_MultiByte::wordWrap('abcdef', 2, ' ', true, 'utf-8');

you'll get "ab cd cdef". But expected result is "ab cd ef".

Activity

Hide
Alexander added a comment -

The problem actually is in line 62 of Zend/Text/MultiByte.php:

$line = substr($string, strlen($matches[0]));

$string is the first parameter for the method wordWrap(). In cycle this code always cuts part from input string, but not from actual value. It should be:

$line = substr($line, strlen($matches[0]));

Show
Alexander added a comment - The problem actually is in line 62 of Zend/Text/MultiByte.php: $line = substr($string, strlen($matches[0])); $string is the first parameter for the method wordWrap(). In cycle this code always cuts part from input string, but not from actual value. It should be: $line = substr($line, strlen($matches[0]));
Hide
Ben Scholzen added a comment -
  • Fixed in r14283-14284 and merged into 1.7 release branch with r14285.
  • Required a complete rewrite of the method
  • Missing unit tests added
Show
Ben Scholzen added a comment -
  • Fixed in r14283-14284 and merged into 1.7 release branch with r14285.
  • Required a complete rewrite of the method
  • Missing unit tests added

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: