Closed vrocheUP closed 6 years ago
Hello, I tried this with an email with a quote in it with the 9.1/bugfixes branch, and I can't reproduce the issue. Could you send to me the original email that cause this error? Or attach it to the issue? Thank you, Regards, Tomolimo
To answer your question: if you want to cancel the integration of this email, you have to delete it from the mailbox. GLPi is still trying to insert it as it is kept in the mailbox
regarding the is_private field value: as the field is an integer, there is no need for the quotes, but I believe the real root cause is the ' in l'identifiant
It seems that the collector mailbox is empty. Trying to investigate further more.
you mean on your mail server?
Yes I confirm : the mailbox is empty. GLPI is configured with POP
Sorry, the mailbox is not empty, I was looking in the wrong one. The message was in the user's mailbox corresponding to the "'Reply-to" field, as configured in GLPI. That's pure logic. Sorry for the inconvenience. I've learned something today.
Regards, Valéry
Is it possible, in the future, to have quotes really escaped ?
they are really :), as I said, I cannot reproduce the issue, mine quotes are escaped. that's why, if you send to me (or attach) the faulty email, I can try to reproduce the issue
Oh sh... I have deleted the message, forgot your request. Fortunately, terminal is still open, I have a "screen copy", see it attached bogus_mail.txt
Full error message needed, with the SQL error message and the backtrace.
is_private being not escaped IS NOT the issue.
The full error message is at the top of this thread.
Forgot the backtrace.
2016-11-09 10:26:01 [@glpi]
*\ MySQL query error:
SQL: INSERT
INTO glpi_ticketfollowups
(content
,tickets_id
,users_id
,requesttypes_id
,is_private
,date
,date_creation
,date_mod
) VALUES (\'Bonsoir,\nJe vous réponds pour vous donner la réponse à ma question secrète : xxxxxxx,\nSi je me suis trompé, pourriez vous quand même envoyer l\'identifiant sur la boite laposte.net ? \nVous remerciant d\'avance,\nCordialement,\nA. François\n\nLe 4 novembre 2016 à 22:22, <helpdesk@univ-poitiers.fr> a écrit :\n\n \n\n\',\'2602\',\'0\',\'0\',0,\'2016-11-09 10:26:01\',\'2016-11-09 10:26:01\',\'2016-11-09 10:26:01\')
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identifiant sur la boite laposte.net ? \nVous remerciant d'avance,\nCordialement' at line 2
Backtrace :
inc/commondbtm.class.php:427
inc/commondbtm.class.php:838 CommonDBTM->addToDB()
inc/mailcollector.class.php:554 CommonDBTM->add()
inc/mailcollector.class.php:1614 MailCollector->collect()
: MailCollector::cronMailgate()
inc/crontask.class.php:803 call_user_func()
front/cron.php:88 CronTask::launch()
unfortunately, the attached text file is not a real email: it's an email representation! could you try on your side to reproduce the issue (with a new email), and then to send to me the faulty email?
The full error message is at the top of this thread.
It was not.
The important part if "near 'identifiant sur la boite laposte.net" And indeed l'identificant* create this issue, the body not being escaped.
the body not being escaped.
???
For me the following code really does the escape (file: mailcollector.php
, function buildTicket
, line: 930):
}
$tkt = Toolbox::addslashes_deep($tkt);
return $tkt;
}
When sending an email with body: Test fu'p
then I get Test fu\'p
: the quote is really escaped.
I didn't say the code does not escape the body ;) I only said it is not escaped to above debug output.
ok :)
In mailcollector, we have $tkt = Toolbox::addslashes_deep($tkt);
But in TicketFollowup::prepareInputForAdd => Ticket::setSimpleTextContent => Html::entity_decode_deep(). => httml_entity_decode($value, ENT_QUOTES, "UTF-8"));
So, I think that if a mail contains an encoded quote ("'"), this can raise such issue.
Hello, Attached is a mail that can't be added to database, same error. It seems that this error occurs only with gmail accounts. mail.txt
I've just tested adding a followup to a ticket with single quote from a "standard" mailer and from gmail on current 9.1/bugfixes branch (mostly 9.1.3); I cannot reproduce the issue.
Hello team, My GLPI version is 9.1.2. The problem is still occurring with messages sent from a GMail address :
- when writing to a receiver to create a ticket, everything works as expected, the ticket is created
- if replying to the notification, the collector has an error (same error as before) : 2017-07-13 15:10:03 [@glpi] *** MySQL query error: SQL: INSERT INTO
glpi_ticketfollowups
(content
,tickets_id
,users_id
,requesttypes_id
,is_private
,date
,date_creation
,date_mod
) VALUES (\'Cette fois on ne met pas d\'apostrophes\n\nLe 13 juillet 2017 à 13:55, <helpdesk@univ-poitiers.fr> a écrit :\n\n \n\n\',\'10727\',\'0\',\'0\',0,\'2017-07-13 15:10:01\',\'2017-07-13 15:10:01\',\'2017-07-13 15:10:01\') Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'apostrophes\n\nLe 13 juillet 2017 à 13:55, <helpdesk@univ-poitiers.fr> a ' at line 2 Backtrace : inc/commondbtm.class.php:436 inc/commondbtm.class.php:852 CommonDBTM->addToDB() inc/mailcollector.class.php:554 CommonDBTM->add() inc/mailcollector.class.php:1614 MailCollector->collect() : MailCollector::cronMailgate() inc/crontask.class.php:832 call_user_func() front/cron.php:88 CronTask::launch()
Does the last version correct this problem ?
Bonne fin de journée :)
Last comment : when going to "configuration -> receivers" and clicking on the "list of not imported emails" button, GLPI does import the emails with no errors.
HI,
Same issue for us...our GLPI version is 9.1.6, we can reproduce the error. We are using gmail (G-Suite) as corporate mail server. Reproduce part of original email:
Gracias Luis Quisiera acceder a las carpetas que gestionan Paco y Patro para almacenar los reportes de operaci=C3=B3n en general, tanto de filiales = como de BU's Solo Lectura es suficiente. No tengo ninguna actuaci=C3=B3n que realiz= ar
And here the SQL error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's\nSolo Lectura es suficiente. No tengo ninguna actuación que realizar\n\nEl 20' at line 2
It´s a bug with the apostrophe
I have the same problem on 9.2.1:
*** MySQL query error: SQL: INSERT INTO
glpi_tickets(
content,
name,
urgency,
requesttypes_id,
entities_id,
status,
impact,
priority,
users_id_recipient,
itilcategories_id,
date,
global_validation,
type,
date_creation,
date_mod) VALUES ('Alerte relative aux nouvelles mises à jour Les 8 nouvelles mises à jour suivantes ont été synchronisées avec FLESRV202 depuis vendredi 5 janvier 2018 05:20 (GMT).\n\nMises à jour critiques et de sécurité <a href=\"http://support.microsoft.com/kb/4056568\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"Mise à jour de sécurité pour Internet Explorer 10 pour Windows Server 2012 (KB4056568)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/help/4056894\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"2018-01 Correctif cumulatif mensuel de qualité pour Windows 7 pour les systèmes basés sur x86 (KB4056894)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/help/4056894\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"2018-01 Correctif cumulatif mensuel de qualité pour Windows Server 2008 R2 pour les systèmes basés sur Itanium (KB4056894)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/help/4056894\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"2018-01 Correctif cumulatif mensuel de qualité pour Windows 7 pour les systèmes basés sur x64 (KB4056894)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/help/4056894\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"2018-01 Correctif cumulatif mensuel de qualité pour Windows Server 2008 R2 pour les systèmes basés sur x64 (KB4056894)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/help/4056896\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"2018-01 Correctif cumulatif mensuel de qualité pour Windows Server 2012 pour les systèmes basés sur x64 (KB4056896)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/kb/4056568\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"Mise à jour de sécurité pour Internet Explorer 9 pour Windows Server 2008 (KB4056568)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\n<a href=\"http://support.microsoft.com/kb/4056568\" title=\"Cliquez ici pour consulter des informations supplémentaires sur cette mise à jour\"Mise à jour de sécurité cumulative pour Internet Explorer 9 pour Windows Server 2008 pour les systèmes x64 (KB4056568)\nUn problème de sécurité qui pourrait avoir un impact sur votre système a été identifié dans un produit logiciel Microsoft. Vous pouvez renforcer la protection de votre système en installant cette mise à jour de Microsoft. Pour consulter la liste complète des problèmes résolus par cette mise à jour et en savoir plus, reportez-vous à l'article correspondant de la Base de connaissances Microsoft. Une fois la mise à jour installée, vous serez peut-être amené à redémarrer l’ordinateur.\n\nAutres mises à jour Aucune nouvelle mise à jour non critique ou non liée à la sécurité n’a été synchronisée.','WSUS : Alerte relative aux nouvelles mises à jour en provenance de FLESRV202','3','2','6','2','3','3','9960','5','2018-01-09 14:10:01','1','1','2018-01-09 14:10:01','2018-01-09 14:10:01') Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'article correspondant de la Base de connaissances Microsoft. Une fois la mise à' at line 2 Backtrace : inc/commondbtm.class.php:504 inc/commondbtm.class.php:928 CommonDBTM->addToDB() inc/mailcollector.class.php:596 CommonDBTM->add() inc/mailcollector.class.php:1659 MailCollector->collect() : MailCollector::cronMailgate() inc/crontask.class.php:832 call_user_func() front/cron.php:87 CronTask::launch()
mail are wus report,unfortunately, problem is appearing since i have update from 9.1.6 to 9.1.7.1 and 9.2.1
Good afternon. I have the same issue. For example:
log - sql-errors.log
2018-01-15 13:40:10 [6@corp-glpi-hmg]
*** MySQL query error:
SQL: INSERT INTO `glpi_tickets` (`content`,`name`,`urgency`,`requesttypes_id`,`entities_id`,`status`,`impact`,`priority`,`users_id_lastupdater`,`users_id_recipient`,`itilcategories_id`,`date`,`global_validation`,`locations_id`,`slas_ttr_id`,`slas_tto_id`,`ttr_slalevels_id`,`time_to_resolve`,`sla_waiting_duration`,`time_to_own`,`type`,`date_creation`,`date_mod`) VALUES ('teste **'aspas'** teste\n\nAtt,\n\nJeffe***** \nAnalista de Suporte\nBo**** Ho***is & ****rts \n+55 41 2169-4768\n+55 41 99253-5789\njeff*******@******n.c***\nwww.bourbon.com.br','teste aspas 2','3','2','0','2','3','3','6','6','0','2018-01-15 13:40:02','1','21','2','1',0,'2018-01-18 10:10:02',0,'2018-01-18 10:10:02','2','2018-01-15 13:40:02','2018-01-15 13:40:02')
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'aspas' teste\n\nAtt,\n\nJefferson Butyn \nAnalista de Suporte\nBourbon Hotéis &' at line 2
Backtrace :
inc/commondbtm.class.php:504
inc/commondbtm.class.php:928 CommonDBTM->addToDB()
inc/mailcollector.class.php:596 CommonDBTM->add()
front/mailcollector.form.php:81 MailCollector->collect()
When is used ' "quotes" in body of mail, it happens this issue!!
I'm using GLPI 9.2.1 Mails Gmail Ubuntu Server 16.04
Any news about this bug?
Hello. Just did a bunch of tests with some of the sentences pasted here:
I tested also with glpi ui or via cron cli.
None of my tests failed, i didn't had any sql errors with current 9.2/bugfixes (future 9.2.2)
We are having a bunch of problems with this too. We had no mail receiver issues on 9.1.5. Now that we are on 9.2.x, we have many emails that do not import. This is causing many missed tickets. Like everyone else, we use g suite w/imap. The 1 thing in common with all the messages is that they contain a single quote.
Exactly, this behavior is always on a reply (g-Suite also) to a open ticket with a single quote in the body of email
For us, it mostly affects new tickets as our help desk techs usually reply through the web. What can I do to help debug the issue so we can get this fixed?
Since we were not able to reproduce this issue; we need a clear and precise way to reproduce on current version.
I would be happy to provide access to any logs or even access to a dev server w/gmail account to get this resolved. We are missing many tickets because of this bug.
We have the same issue... GLPI 9.2.2- If I click "Get email tickets now" it works. But if I run "/usr/bin/php5 /var/www/html/glpi/front/cron.php" no errors but no E-mails fetched!!! I tested it with POP and IMAP. In mailgate its "CLI" and its enabled.
Cron LOG: 2018-04-02 12:10:02 [@srvername] External #3: Launch taskscheduler 2018-04-02 12:14:37 [2@srvername] Internal #1: Launch infocom 2018-04-02 12:15:01 [@srvername] External #1: Launch queuednotification 2018-04-02 12:15:01 [@srvername] External #2: Launch taskscheduler 2018-04-02 12:15:01 [@srvername] External #3: Launch wakeupAgents
It is not a funny issue!!!
Same error for me
I have tried multiple versions of PHP all the way up to 7.2 and it made no difference. Still the exact same error. This really needs to be a higher priority as a help desk is kinda useless if users cannot file tickets.
I founded the solution : you must activate the option : Enable rich text for helpdesk (In french : Utiliser du texte riche pour l’assistance) on Configuration - General - Helpdesk
Sorry : finded :D
Thanks for the solution. It's ok for our tickets now!
Thank you lolokai! Mail queue is now empty.
I have the same issue for emails coming from Gmail. Single quotes are HTML encoded (') and are not backslashed by Toolbox::addslashes_deep, and MySQL receive the INSERT with single quotes (converted to text), which creates an error.
I think it's a non sense to confuse and mix « rich text » and handling HTML encoded quotes. Incomig emails should be correctly handled, whatever users want in their UI. Requesters send emails with their favorite app, and do not care how GLPI is configured.
Here is a quick patch that will patch HTML quotes (inc/mailcollector.class.php:966): $tkt = str_replace ("'", "'", $tkt); $tkt = Toolbox::addslashes_deep($tkt);
So, to resume; this issue happens when an ticket is opened without rich text and when there is something like '
in the content.
This is not directly related to the mail collector, same problem happens from the UI.
Hi,
Not for me, this behavior occurs when a user reply to a ticket previusly opened and when the body of email contain an ' (apostrof) for example "L'Altet" in this case, we have on sql-errors.log the next message
" Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Altet - C/ dels Molins, 4 Apdo. de correos 914\n\n46870 Ontinyent / "
Only occurs on reply to tickets previusly opened, on new tickets this behavior not occur.
https://www.fileformat.info/info/unicode/char/27/index.htm
Regards
To all participants, (maybe recent one btw, ping @lgigant & @jcheger).
Could you test the following change and let us know the resolution of this issue: https://github.com/trasher/glpi/commit/d9a58d2656475f598a941d5b8d2a76dcf6aa9103
Hey, I manually applied the changes from commit 0fbb2f005b22ed9fb24e7dcbc49dc165a00664de (we are running 9.2.1 and waiting for 9.2.4 to upgrade) but the issue still occurs. Are there dependencies I am not aware of or perhaps another place this str_replace needs to occur?
2018-06-07 10:33:22 [33@GLPI]
*** MySQL query error:
SQL: INSERT
INTO glpi_tickets
(content
,name
,urgency
,requesttypes_id
,entities_id
,status
,impact
,priority
,users_id_lastupdater
,itilcategories_id
,date
,global_validation
,type
,date_creation
,date_mod
) VALUES ('Testing this function's functionality.\n\n','Re: [GLPI #0006397] Closing of the Ticket Test ticket, please ignore','3','0','0','1','3','3','33','0','2018-06-07 10:33:21','1','1','2018-06-07 10:33:21','2018-06-07 10:33:21')
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's functionality.\n\n' at line 2
Backtrace :
inc/commondbtm.class.php:504
inc/commondbtm.class.php:928 CommonDBTM->addToDB()
inc/mailcollector.class.php:596 CommonDBTM->add()
front/mailcollector.form.php:81 MailCollector->collect()
Try with latest 9.2/bugfixes
I don't understand what you mean. That version is earlier then what I run, 9.2.1 and where this commit will be applied 9.2.4. Sorry if I am missing something obvious...
@chaoservices, here is some nightly tarballs: https://forge.glpi-project.org/tarballs/
It doesn't seem that this is completely fixed yet. I upgraded to 9.2.4 and changed back to plain text mode. I have a stuck message with the same error. The body has the word "can't" in it.
@trasher Any way to reopen this? It is not fixed as of 9.2.4. Currently have 4 emails failing to import. All have a single quote. I looked at the patches for this and noticed that it attempts to remove ' but the gmail source shows '
Hello team, I have a strange bug with GLPI 9.1. Extract from sql-errors.log :
2016-11-09 08:51:02 [@glpi] * MySQL query error: SQL: INSERT INTO
glpi_ticketfollowups
(content
,tickets_id
,users_id
,requesttypes_id
,is_private
,date
,date_creation
,date_mod
) VALUES (\'Bonsoir,\nJe vous réponds pour vous donner la réponse à ma question secrète : xxxx,\nSi je me suis trompé, pourriez vous quand même envoyer l\'identifiant sur la boite laposte.net ? \nVous remerciant d\'avance,\nCordialement,\nA. François\n\nLe 4 novembre 2016 à 22:22, <helpdesk@univ-poitiers.fr> a écrit :\n\n \n\n\',\'2602\',\'0\',\'0\',0**,\'2016-11-09 08:51:01\',\'2016-11-09 08:51:01\',\'2016-11-09 08:51:01\')As you can see, the value of the field "is_private" is not delimited by simple quotes. There is a new line in sql-erros.log every 5 minutes (this is the time-step I choosed for cron) since #4 of november.
So I have 2 or 3 questions :
Sincerely, Valéry config_GLPI.txt