Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail fetcher - Excessive errors processing emails #6647

Open
Franck-ZINDEX opened this issue Dec 6, 2023 · 0 comments
Open

Mail fetcher - Excessive errors processing emails #6647

Franck-ZINDEX opened this issue Dec 6, 2023 · 0 comments

Comments

@Franck-ZINDEX
Copy link

Franck-ZINDEX commented Dec 6, 2023

Prerequisites

  • [ ❓ ] Can you reproduce the problem in a fresh installation of the "develop" branch?
  • [ ❌ ] Do you have any errors in the PHP error log, or javascript console?
  • [ ✅ ] Did you check the osTicket forums?
  • [ ✅ ] Did you perform a cursory search to see if your bug or enhancement is already reported?

Description

Mail fetcher doesn't create tickets :

Excessive errors processing emails for ssl://xxx.xxx.xx:993/IMAP (Support [<xxxx@xxxxx.fr>](mailto:xxxx@xxxxxx.fr)).

Please manually check the Fetch Folder () [1/20 - 0/1]

After some investigation, i get error on json_decode, line 1358 in file include/class.dynamic_forms.php when he try to get attached file.

PHP Fatal error:  Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in /ostickets/include/class.dynamic_forms.php:1358
Stack trace:
#0 /ostickets/include/class.dynamic_forms.php(1358): json_decode()
#1 /ostickets/include/class.dynamic_forms.php(1316): DynamicFormEntry->saveAnswers()
#2 /ostickets/include/class.ticket.php(4392): DynamicFormEntry->save()
#3 /ostickets/include/api.tickets.php(142): Ticket::create()
#4 /ostickets/include/api.tickets.php(210): TicketApiController->createTicket()
#5 /ostickets/include/api.tickets.php(267): TicketApiController->processEmail()
#6 /ostickets/api/pipe.php(26): PipeApiController::process()
#7 {main}
  thrown in /ostickets/include/class.dynamic_forms.php on line 1358

This error appear with this command (found on your forum) :
php8.1 api/pipe.php < test.eml

If i return blank $fieldClean value at this line, the ticket is created with all datas.

EDIT : Found a fix at line 1358 in include/class.dynamic_forms.php :

❌ Cause error

$fieldClean = json_decode($fieldClean[0], true);

✅ Fix, $fieldClean[0] is already an array

$fieldClean = $fieldClean[0];

Steps to Reproduce

  1. Configure Mail Fetcher with IMAP, port 993, Move mail to folder
  2. Launch manually or with cron to fetch mail
  3. Error appear in OsTickets logs and sent by mail

Expected behavior:

Get ticket created

Actual behavior:

Get Error

Versions

Capture d'écran 2023-12-06 152302

EML file who cause error : https://pastebin.com/qeZbR7sS
Password : npaz44rcVp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant