Closed DuckThom closed 2 years ago
This probably should actually be changed to use Str:: functions instead. Feel free to send a pull request, or I might get a chance to update it next week.
Switched to Str::function in https://github.com/jdavidbakr/mail-tracker/releases/tag/5.0.7
Error
Summary
Currently, the content length is calculated with
strlen
and then trimmed accordingly usingsubstr
. For single byte characters, this is fine. However, SQL errors start to occur when sending emails in, for example, French. This is because characters likeÂ
are not treated properly bysubstr
andstrlen
.Issue:
Using
strlen
andsubstr
:Using
mb_substr
andmb_strlen
:Suggested change:
Old:
https://github.com/jdavidbakr/mail-tracker/blob/45b0923537912b073aeb520d33de04c52c2d2191/src/MailTracker.php#L171
New:
Note: I also added
- 3
to the substr call, this is because the max value of the text column is 65535 but '...' is being appended to the trimmed string, therefor the string would still be too long.