bmarci
7 November 2024 14:07
1
When trying to set up and send test email on V8.7 , the following error occurs:
‘mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead’
I have managed to fix it and I would like to contribute with the code changes. How should I do it? Can I raise a pull request and that’s it, or do we have to raise a bug ticket before?
rsp
7 November 2024 14:47
2
Yes, you can do PR here:
https://github.com/salesagility/SuiteCRM-Core/pulls
You can raise issue here:
pgr
7 November 2024 18:07
3
There is quite complete documentation on this here:
It is helpful to raise an Issue, additionally to the PR.
bmarci
8 November 2024 10:04
4
Thanks for the information.
I have raised the issue:
opened 09:08PM - 07 Nov 24 UTC
Type: Bug
### Issue
There is a failing code in the legacy Localization.php in translateCh… arsetMIME function causing error on email sending.
The failing code is here:
```
$result = mb_encode_mimeheader($string, $toCharset, $encoding);
```
Digging deeper it is a change in polyfill-mbstring dependency:
```public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
{
trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
}```
### Possible Fix
As suggested, use ```iconv_mime_encode```. I have a working local solution for this which fix this issue.
```
public function translateCharsetMIME($string, $fromCharset, $toCharset = 'UTF-8', $encoding = "Q")
{
$preferences = array(
'input-charset' => $fromCharset,
'output-charset' => $toCharset,
'line-length' => 76,
'scheme' => $encoding,
'line-break-chars' => "\n"
);
$result = iconv_mime_encode('', $string, $preferences);
return substr($result, 2);
}
```
I will create a PR for this.
### Steps to Reproduce the Issue
```bash
1. Set up an new suitecrm environment (tested on 8.7 and php 8.2)
2. Login and go to admin page
3. Configure email and try to send a test email
...
```
### Context
I tried the email functionality. I have not found any other topic to this certain issue, so I took a look at the code.
### Version
8.7.0
### What browser are you currently using?
Chrome
### Browser Version
_No response_
### Environment Information
PHP 8.2
### Operating System and Version
Ubuntu 20.04.6 LTS
and I have made the PR:
salesagility:hotfix
← blummarci24:hotfix
opened 07:41AM - 08 Nov 24 UTC
## Description
This update addresses a critical bug in the Localization.php fil… e within the translateCharsetMIME function, which was causing an error during email sending. The issue was linked to the use of mb_encode_mimeheader, which triggered a warning due to updates in the polyfill-mbstring dependency.
## Motivation and Context
There is a failing code in the legacy Localization.php in translateCharsetMIME function causing error on email sending.
## How To Test This
1. Set up an new suitecrm environment (tested on 8.7 and php 8.2)
2. Login and go to admin page
3. Configure email and try to send a test email
## Types of changes
- [ x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
### Final checklist
- [ x] My code follows the code style of this project found [here](https://docs.suitecrm.com/community/contributing-code/coding-standards/).
- [ ] My change requires a change to the documentation.
- [x ] I have read the [**How to Contribute**](https://docs.suitecrm.com/community/contributing-code/) guidelines.
I hope I did everything right
1 Like
bmarci
29 November 2024 11:53
5
Is there any way to get this approved? How this is done usually? I have committed this 3 weeks ago, so I have a concern that I might miss something
pgr
29 November 2024 14:36
6
I have PRs with more than 3 years waiting…
There’s a big bottleneck with the maintainers reviewing the PRs, so things typically take a long time, but you never know which ones are going to get merged sooner or not.
Sorry