View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0009086 | mantisbt | localization | public | 2008-04-18 08:56 | 2014-04-11 15:16 |
| Reporter | tomc | Assigned To | grangeway | ||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.1.1 | ||||
| Fixed in Version | 1.2.0rc1 | ||||
| Summary | 0009086: 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 |
| ||||
| Tags | patch | ||||
| 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
| ||||
|
Note: this patch requires mbstring support in php that we dont currently require. |
|
|
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. |
|
|
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(). |
|
|
We've been gradually working through these issues - it should be possible to support utf8 for people without the mbstring extension |
|
|
Cleared fixed_in_version and moved target version to 1.x.x. |
|
|
@grangeway, isn't this resolved in 1.2.0rc1? We now use utf8_substr(). |
|
|
To Paul for feedback. |
|
|
probably although i'd like to use a different function - so that we split at end of word closest to 50 chars |
|
|
Reminder sent to: grangeway Do you want to change something in master? |
|
|
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. |
|
|
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 |
|