View Issue Details

IDProjectCategoryView StatusLast Update
0009086mantisbtlocalizationpublic2014-04-11 15:16
Reportertomc Assigned Tograngeway  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.1 
Fixed in Version1.2.0rc1 
Summary0009086: email_queue_add fails with long UTF-8 relationship text
Description

Long relationship summary is occasionally splitted in the middle of a multibyte character. This causes "APPLICATION ERROR 0000401" when adding e-mail to a database table.

Steps To Reproduce
  1. Add issue with summary "12345678901234567890123456789012345678?01234567890"
  2. Add second issue
  3. Add relationship between this two issues
  4. Add note to the second issue - this triggers error.
Tagspatch
Attached Files
relationship.patch (578 bytes)   
Index: relationship_api.php
===================================================================
--- relationship_api.php	(revision 5171)
+++ relationship_api.php	(working copy)
@@ -581,7 +581,7 @@
 			$t_relationship_info_text .= $t_bug->summary;
 		}
 		else {
-			$t_relationship_info_text .= substr( $t_bug->summary, 0, $t_summary_wrap_at - 3 ) . '...';
+			$t_relationship_info_text .= mb_substr( $t_bug->summary, 0, $t_summary_wrap_at - 3, lang_get( 'charset', lang_get_current() ) ) . '...';
 		}
 
 		# add delete link if bug not read only and user has access level
relationship.patch (578 bytes)   

Activities

grangeway

grangeway

2008-07-27 15:35

reporter   ~0018681

Note: this patch requires mbstring support in php that we dont currently require.

slankes

slankes

2008-11-09 12:24

reporter   ~0019824

Can this be solved by advising people to activate mb_string-overloading to their php-config?

That way the mb_* versions would be used automatically if they are available.

http://www.php.net/manual/en/mbstring.overload.php

vboctor

vboctor

2009-05-20 04:11

manager   ~0021860

Updated the code to use mb_substr() and added a check to core/php_api.php to define mb_substr to map to substr() if mb_substr is not defined.

I've searched the codebase and found more instances of substr. We should revisit these to make sure there is no issues, or change them all to mb_substr().

grangeway

grangeway

2009-05-20 04:29

reporter   ~0021861

We've been gradually working through these issues - it should be possible to support utf8 for people without the mbstring extension

vboctor

vboctor

2009-05-21 04:06

manager   ~0021871

Cleared fixed_in_version and moved target version to 1.x.x.

vboctor

vboctor

2009-06-30 22:07

manager   ~0022335

@grangeway, isn't this resolved in 1.2.0rc1? We now use utf8_substr().

siebrand

siebrand

2009-07-06 19:08

reporter   ~0022431

To Paul for feedback.

grangeway

grangeway

2009-07-08 17:52

reporter   ~0022452

probably although i'd like to use a different function - so that we split at end of word closest to 50 chars

atrol

atrol

2014-01-21 16:39

developer   ~0039126

Reminder sent to: grangeway

Do you want to change something in master?
If not, we could set this to resolved and remove target version.
WDYT?

vboctor

vboctor

2014-03-28 03:05

manager   ~0039776

It seems that master uses utf8_substr() which calls mb_substr() which is defined in php_api.php if it is not exposed by php.

So this seems to me like a resolved issue.

grangeway

grangeway

2014-03-28 15:57

reporter   ~0039780

I'd say so.

In any case, we are looking at adding templating functionality for emails - so if anything, the 'fix' for this issue will be to dump the substr stuff (as someone might want a full string in their template), so I'm pretty sure none of us are going to be testing whether we split the string in the middle correctly :)

Paul

Related Changesets

MantisBT: master a5e402bf

2009-05-20 04:09

vboctor


Details Diff
Fixes 0009086: email_queue_add fails with long UTF-8 relationship text. Affected Issues
0009086
mod - core/relationship_api.php Diff File
mod - core/php_api.php Diff File