Hi, the regex /charset=["\']?([^"\']*)/i' at line 297 matches 'iso-8859-15; format=flowed' instead of 'iso-8859-15'
I've replaced the regex with: "/charset=[\"|\']*([^\;|^\n|^\"|^\']*)[\"|\'|\;]*/i" and seems to work.
The bug causes body text truncation using special chars like € or à encoded in iso-8859
__
edit 19.29: updated regex
Wrong charset regex in mime_decode.php
-
- Posts: 6
- Joined: 16 Jan 2021, 06:19
- Name: Ettore Perri
- Location: Italy Lamezia Terme
- Company Name: Weev Solutions di Perri Ettore
-
- Posts: 6
- Joined: 16 Jan 2021, 06:19
- Name: Ettore Perri
- Location: Italy Lamezia Terme
- Company Name: Weev Solutions di Perri Ettore
Re: Wrong charset regex in mime_decode.php
The bug is still present in 2.8.1.
Bug scenario:
If the charset is not the last parameter of Content-Type and if special characters are present in mail body the message is truncated.
Example of Content-Type:
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Solution:
Replace the line 297 of ext/classes/mail/mime_decode.php with this:
Bug scenario:
If the charset is not the last parameter of Content-Type and if special characters are present in mail body the message is truncated.
Example of Content-Type:
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Solution:
Replace the line 297 of ext/classes/mail/mime_decode.php with this:
Code: Select all
if(preg_match('/charset=[\"|\']*([^\;|^\n|^\"|^\']*)[\"|\'|\;]*/i', $headers[$key]['value'], $matches))
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong charset regex in mime_decode.php
Strange, I naver had issue like hits. But anyway I have done this modification. See attached.
This fix will be for 2.8.2
This fix will be for 2.8.2
- Attachments
-
- mime_decode.zip
- (9.58 KiB) Downloaded 75 times
-
- Posts: 6
- Joined: 16 Jan 2021, 06:19
- Name: Ettore Perri
- Location: Italy Lamezia Terme
- Company Name: Weev Solutions di Perri Ettore
Re: Wrong charset regex in mime_decode.php
Hi, if you want to check this behaviour I can send an email to a your integrated account.
Regards
Regards
-
- Posts: 6
- Joined: 16 Jan 2021, 06:19
- Name: Ettore Perri
- Location: Italy Lamezia Terme
- Company Name: Weev Solutions di Perri Ettore
Re: Wrong charset regex in mime_decode.php
this one is better..
/charset=[\"\']*([^\;\n\"\']*)/i
/charset=[\"\']*([^\;\n\"\']*)/i
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong charset regex in mime_decode.php
ok, updated. This fix will be in 2.8.2
- Attachments
-
- mime_decode.zip
- (9.57 KiB) Downloaded 82 times
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong charset regex in mime_decode.php
So it works ok for you now?
-
- Posts: 6
- Joined: 16 Jan 2021, 06:19
- Name: Ettore Perri
- Location: Italy Lamezia Terme
- Company Name: Weev Solutions di Perri Ettore
Re: Wrong charset regex in mime_decode.php
changing the regex it works ok