cypht icon indicating copy to clipboard operation
cypht copied to clipboard

Replying to some mails leads to Array instead of string

Open EvilDragon opened this issue 2 years ago • 6 comments

Issue

Replying to some emails leads to a 500 error.

The PHP log file in this case was:

mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in /usr/local/share/cypht/modules/core/message_functions.php: mod_fcgid: stderr: Stack trace: mod_fcgid: stderr: #0 /usr/local/share/cypht/modules/core/message_functions.php(539): addr_split() mod_fcgid: stderr: #1 /usr/local/share/cypht/modules/smtp/modules.php(1265): process_address_fld() mod_fcgid: stderr: #2 /usr/local/share/cypht/modules/smtp/modules.php(800): get_primary_recipient() mod_fcgid: stderr: #3 /usr/local/share/cypht/lib/module.php(526): Hm_Output_compose_form_content->output() mod_fcgid: stderr: #4 /usr/local/share/cypht/lib/modules_exec.php(101): Hm_Output_Module->output_content() mod_fcgid: stderr: #5 /usr/local/share/cypht/lib/modules_exec.php(83): Hm_Module_Exec->process_result() mod_fcgid: stderr: #6 /usr/local/share/cypht/lib/modules_exec.php(44): Hm_Module_Exec->run_output_module() mod_fcgid: stderr: #7 /usr/local/share/cypht/lib/dispatch.php(236): Hm_Module_Exec->run_output_modules() mod_fcgid: stderr: #8 /usr/local/share/cypht/lib/dispatch.php(190): Hm_Dispatch->process_request() mod_fcgid: stderr: #9 /usr/local/share/cypht/index.php(50): Hm_Dispatch->__construct() mod_fcgid: stderr: #10 {main} mod_fcgid: stderr: thrown in /usr/local/share/cypht/modules/core/message_functions.php on line 472

I didn't see anything special about that email. It was a multipart message, one sender and one receiver, some attachments. Nothing appears to be out of the ordinary. I did notice that this is the case with ALL emails I receive from that company though.

Here's the header (I've changed the IDs and names, so no secrets are shared here):

This is the subject Date Wed Oct 27 16:04:43 2021 CEST (20 hours, 13 minutes) From Someone Else [email protected]> To "[email protected]" <[email protected]> Tags Seen Return-Path <[email protected]> X-Original-To [email protected] Delivered-To [email protected] Delivered-To [email protected] Received by boss.slowly.de (Postfix) id 3CF7242CD1410; Wed, 27 Oct 2021 16:04:50 +0200 (CEST) Received from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) by boss.slowly.de (Postfix) with ESMTPS id C2A233F130F for <[email protected]>; Wed, 27 Oct 2021 16:04:49 +0200 (CEST) Received from EBW-SSZ-EXC01.EBVA.NETZ ([185.112.216.37]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mqagw-1n1t4H10iG-00mXEB for <[email protected]>; Wed, 27 Oct 2021 16:04:45 +0200 Received from ERC-SRZ-EXC01.ERCI.NETZ (192.168.121.6) by ERC-SRZ-EXC01.ERCI.NETZ (192.168.121.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.5; Wed, 27 Oct 2021 16:04:44 +0200 Received from ERC-SRZ-EXC01.ERCI.NETZ ([fe80::d4b4:d481:3d28:f489]) by ERC-SRZ-EXC01.ERCI.NETZ ([fe80::d4b4:d481:3d28:f489%4]) with mapi id 15.02.0858.010; Wed, 27 Oct 2021 16:04:44 +0200 Thread-Topic This is the subject Thread-Index AdfLO3QSWs167kWEFijfl1QS+a83RlA== Message-ID <[email protected]> Accept-Language de-DE, en-US Content-Language de-DE X-MS-Has-Attach yes X-MS-TNEF-Correlator x-originating-ip [192.168.0.199] Content-Type multipart/mixed; boundary="_004_7cfa89berfrg5ffbbcbe91f8406a46c5ercingolstadtde_" MIME-Version 1.0 X-Provags-ID V03:K1:cuFywperfWn8yPc5zFe9Doblq5yLk48rijr451X4zp3aWhR8ZP 5P4bHebnFJMQZDuNsaE+DhONV4i33dIv+S94IBmt/hdnk7Vk+QUlx6jmyDHAx2B9N8GZxbH f3GcZ5pott7oEGdBuxdI5+p8hevXyR0t6/nVavNflH0pLvlaRo7epAK5cANt/8WnJXhcTMw OGmQ29EHpIz5j9XBib2pw== X-Spam-Flag NO X-UI-Out-Filterresults notjunk:1;V03:K0:iuK/wT+YKtA=:z/1WcdXQWlnuXJM3ehKvqP XJK5PaFtoV/ZcSEyMFSogF99Q2frRoA31ydvViM+ItyOFPEBuyOo6DLGrVndJPTY10WCXjQRc W9ApaThmfMtpYmQfLdDEzuvL33aGXBpW1z8lmdFFbv+8/T9UqX5liODctL0xbvrJekDaddlXc RBFqYb3Eqvrw94mQkEXZyr6E7IkMWKnfv9rNZB0Hlg+vtTVnOpJKR+nAsNNqToVXtJhLj/0vY Sr4r6uauh9gMJhDGskEKkQjVoK2OcCmZdDXTQPzJcVw2E/arQG57WjdRDZjunDtf1IAbx4a1L goz4sNSG3+mSYa1bY6DuBlVy7P6fAlT1rX09+RTp0+u21W5SfZ16Ik+21O3Hxw3DerggthtrmG GPjVZWaRosyonnIqzhIkOZ0Aia6YXeUpdF0i0R+rxGAVYjQ65mg+PUCh65QSYLXpzK0AL6Vzg J0JDDh6ja0P5tdLjSfx2wlT7/kwICi+cSLnRo/RS+vS1VBeBncF51VJT2MgIvDJ1qidcyBTdY JSLEFKAVylJvoQiB49M0nJ1K0vYcHEoWQfSNiGQzPjb01A2URZudPhh1X8/Lckgbf1U8Gfx+k ZhOl74uU0HMC69HK/cFlUdC+0K/b8wCZBlWYRvtklFhzR1Wm57LY1bmsQA7olWwiUuOQTanl0 91A0g8WNkUyivnIRWDZkQRuths90QaYVizuOqZJyPRV6U3gergfoaMlPhz4ABoDzaLXkS0 oUj4DPmhWtIIzLUW/GSGT3DJK7IltcYdpT+2gA== Arrival Date 27-Oct-2021 16:04:52 +0200

PHP version 8.0.12, Zend Version 4.0.12, latest master version from 2021-10-26

EvilDragon avatar Oct 28 '21 10:10 EvilDragon

@jasonmunro, Correct me if I'm wrong but I'm looking at this issue and it looks like the same issue as https://github.com/jasonmunro/cypht/issues/544, only with the Delivered-To header.

Do you think we need to add an extra foreach loop or imploding the array would work here as well?

kk6mrp avatar Jan 14 '22 05:01 kk6mrp

@jasonmunro, Correct me if I'm wrong but I'm looking at this issue and it looks like the same issue as #544, only with the Delivered-To header.

Do you think we need to add an extra foreach loop or imploding the array would work here as well?

In the latter case implode() works as we are just plucking links from the header, however in this case we need a loop. I have not looked at the specific code yet but my guess is the best way to handle it is to type check it, and if it's a string make it an array with a single value, then modify the code to always work with arrays.

jasonmunro avatar Jan 14 '22 18:01 jasonmunro

Ok, that's a good idea. I'll work on that when I get some time.

kk6mrp avatar Jan 14 '22 18:01 kk6mrp

@kk6mrp Please trying again with latest code from master.

marclaporte avatar Jul 31 '22 18:07 marclaporte

@kk6mrp We need you

marclaporte avatar Oct 22 '22 23:10 marclaporte

@EvilDragon

Please retest, as a lot has changed since you reported this issue. Notably, we now have 3 active branches and recently released Cypht 2.0.0

  • https://github.com/cypht-org/cypht/releases/tag/v2.0.0
  • https://github.com/cypht-org/cypht/wiki/Lifecycle

marclaporte avatar May 06 '24 23:05 marclaporte