AnsweredAssumed Answered

Potential Bug, InternalEmail.php 7.5.1.0 Professional

Question asked by Francesca Shiekh on Jun 12, 2015
Latest reply on May 30, 2018 by pavan agrawal
I keep getting warnings like:

Warning [2]: Invalid argument supplied for foreach() in /var/www/html/sugarcrm/modules/InboundEmail/InboundEmail.php on line 1801

in my Check Inbound Emails process.

Note that line numbers are not exact because of the additional logging I've added to figure out what was going on.

Line 1801 refers to the highlighted statement below from:
modules/InboundEmail/InboundEmail.php

        function deleteCachedMessages($uids, $fromFolder) {
                global $sugar_config;

                if(!isset($this->email) && !isset($this->email->et)) {
                        $this->email = BeanFactory::getBean('Emails');
                        $this->email->email2init();
                }

                $uids = $this->email->et->_cleanUIDList($uids);

                foreach($uids as $uid) {
                        $file = "{$this->EmailCachePath}/{$this->id}/messages/{$fromFolder}{$uid}.php";

                        if(file_exists($file)) {
                                if(!unlink($file)) {
                                        $GLOBALS['log']->debug("INBOUNDEMAIL: Could not delete [ {$file} ]");
                                }
                        }
                }
        }

I have found that the $uids returned by 

$uids = $this->email->et->_cleanUIDList($uids);

is a string, not an array.

I've not dug further at this point. 
FrancescaS

Outcomes