6.0.0-beta1
7/18/25

[#13163] non-multibyte-aware truncate function in View/Helper/Text.php
Summary non-multibyte-aware truncate function in View/Helper/Text.php
Queue IMP
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester Jasper.Olbrich (at) students (dot) uni-marburg (dot) de
Created 05/06/2014 (4091 days ago)
Due
Updated 05/06/2014 (4091 days ago)
Assigned
Resolved 05/06/2014 (4091 days ago)
Github Issue Link
Github Pull Request
Milestone 2.0.4
Patch No

History
05/06/2014 12:41:38 PM Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
Milestone ⇒ 2.0.4
 
05/06/2014 12:41:03 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit df7b73bf32a1157e79b4165da528439610dad25c
Author: Jan Schneider <jan@horde.org>
Date:   Tue May 6 14:31:20 2014 +0200

     [jan] Make Horde_View_Helper_Text#truncate() and truncateMiddle() 
multibyte-safe (Bug #13163).

  framework/View/lib/Horde/View/Helper/Text.php      |   13 ++++++-------
  framework/View/package.xml                         |    4 ++--
  framework/View/test/Horde/View/BaseTest.php        |    2 +-
  framework/View/test/Horde/View/Helper/TextTest.php |    2 +-
  4 files changed, 10 insertions(+), 11 deletions(-)

http://github.com/horde/horde/commit/df7b73bf32a1157e79b4165da528439610dad25c
05/06/2014 11:51:05 AM Jasper (dot) Olbrich (at) students (dot) uni-marburg (dot) de Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ non-multibyte-aware truncate function in View/Helper/Text.php
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
The function truncate in framework/View/lib/Horde/View/Helper/Text.php 
uses substr and thus fails for example for utf8-strings. To reproduce, 
try to view a mail with this subject
1234567890123456789012345678901234567890123456ü__________________
in "Minimal" mode. This results in the following log entry
PHP ERROR: htmlspecialchars(): Invalid multibyte sequence in argument
because the ü is broken by substr.

There already is a multibyte-aware version of this function in 
framework/Util/lib/Horde/String.php

Saved Queries