Invalid reference of GetHeader function on class EmailMessage
poojaajudia opened this issue · 3 comments
poojaajudia commented
Policy PolicyBounceAutoReply
has a reference to EmailMessage
class with an invalid call to function GetHeader()
. This function is not part of EmailMessage class but it is part of the RawEmailMessage
.
Warning: Invalid argument supplied for foreach() in /var/www/html/env-production/jb-email-synchro/classes/emailbackgroundprocess.class.inc.php on line 176
PHP Fatal error: Uncaught Error: Call to undefined method EmailMessage::GetHeader() in /var/www/html/env-production/jb-itop-standard-email-synchro/core/policy.class.inc.php:2053
Stack trace:
#0 /var/www/html/env-production/jb-itop-standard-email-synchro/model.jb-itop-standard-email-synchro.php(672): jb_itop_extensions\mail_to_ticket\PolicyBounceAutoReply::IsCompliant()
#1 /var/www/html/env-production/jb-itop-standard-email-synchro/model.jb-itop-standard-email-synchro.php(370): MailInboxStandard->ProcessPolicies(Object(EmailMessage), NULL, Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0)
#2 /var/www/html/env-production/jb-email-synchro/classes/mailinboxesemailprocessor.class.inc.php(191): MailInboxStandard->ProcessNewEmail(Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0, Object(EmailMessage))
#3 /var/www/html/env-production/jb-email-synchro/classes/emailbackgroundprocess.class.inc.php(407): MailInboxesEmailProcessor->ProcessMessage(Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0, Ob in /var/www/html/env-production/jb-itop-standard-email-synchro/core/policy.class.inc.php on line 2053
Fatal error: Uncaught Error: Call to undefined method EmailMessage::GetHeader() in /var/www/html/env-production/jb-itop-standard-email-synchro/core/policy.class.inc.php:2053
Stack trace:
#0 /var/www/html/env-production/jb-itop-standard-email-synchro/model.jb-itop-standard-email-synchro.php(672): jb_itop_extensions\mail_to_ticket\PolicyBounceAutoReply::IsCompliant()
#1 /var/www/html/env-production/jb-itop-standard-email-synchro/model.jb-itop-standard-email-synchro.php(370): MailInboxStandard->ProcessPolicies(Object(EmailMessage), NULL, Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0)
#2 /var/www/html/env-production/jb-email-synchro/classes/mailinboxesemailprocessor.class.inc.php(191): MailInboxStandard->ProcessNewEmail(Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0, Object(EmailMessage))
#3 /var/www/html/env-production/jb-email-synchro/classes/emailbackgroundprocess.class.inc.php(407): MailInboxesEmailProcessor->ProcessMessage(Object(Combodo\iTop\Extension\Service\IMAPOAuthEmailSource), 0, Ob in /var/www/html/env-production/jb-itop-standard-email-synchro/core/policy.class.inc.php on line 2053
<p>iTop: An error occurred, check server error log for more information.</p>
jbostoen commented
You're absolutely right, thanks for the detailed report!
poojaajudia commented
@jbostoen still it hasn't been fixed. You only updated one reference of GetHeader function, but there are three more references just above your fix.
switch(true) {
case ($oEmail->GetHeader('x-autoreply') != ''):
case ($oEmail->GetHeader('x-autorespond') != ''):
case (strtolower($oEmail->GetHeader('precedence')) == 'auto_reply'):
// https://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml
// Values for auto-submitted: no, auto-generated, auto-replied, auto-notified
case (preg_match('/^auto/', strtolower($oEmail->oRawEmail->GetHeader('auto-submitted')))):
jbostoen commented
You're absolutely right, this was sloppy. Sorry!