Giter Club home page Giter Club logo

Comments (2)

DBRenny avatar DBRenny commented on August 10, 2024

I have a fix, but should I leave this open so you can create a branch? Do you want me to do it? I haven't done one of those before on here. I would be happy to learn.

Replacing the function with this resolved my issue:

public function handleMimeHeaderDecode($subject)
{
    $GLOBALS['log']->debug('handleMimeHeaderDecode: Starting MIME header decoding for subject: ' . $subject);

    $subjectDecoded = $this->getImap()->MimeHeaderDecode($subject);

    // If $subjectDecoded is a string, log its content to understand why
    if (is_string($subjectDecoded)) {
        $GLOBALS['log']->error('handleMimeHeaderDecode: $subjectDecoded is a string. Content: ' . $subjectDecoded);
        // Instead of returning an error message, we might want to return the original subject
        // or handle this case appropriately based on the actual content of $subjectDecoded.
        return $subject; // returning the original subject for now
    }

    $ret = '';
    if (is_array($subjectDecoded)) { // Checking if it's an array as expected
        $GLOBALS['log']->debug('handleMimeHeaderDecode: $subjectDecoded is an array, proceeding with decoding');
        foreach ($subjectDecoded as $object) {
            if (isset($object->charset) && $object->charset != 'default' && isset($object->text)) {
                $ret .= $this->handleCharsetTranslation($object->text, $object->charset);
            } elseif (isset($object->text)) {
                $ret .= $object->text;
            }
        }
    } else {
        $GLOBALS['log']->error('handleMimeHeaderDecode: $subjectDecoded is not an array');
        // Similar to above, decide how you want to handle this error.
        return $subject; // returning the original subject for now
    }

    $GLOBALS['log']->debug('handleMimeHeaderDecode: Decoding completed, result: ' . $ret);
    return $ret;
}

from suitecrm-core.

clemente-raposo avatar clemente-raposo commented on August 10, 2024

This issue has been fixed on 7.14.4, then ported and released on 8.6.1. Closing

see:
salesagility/SuiteCRM#10323

from suitecrm-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.