pluginsGLPI / formcreator

GLPI Plugin Formcreator (DOWNLOAD : https://github.com/pluginsGLPI/formcreator/releases)
http://www.teclib-edition.com
GNU General Public License v3.0
174 stars 125 forks source link

php error Infinite loop - 2.13.6 #3329

Closed plburguet closed 1 year ago

plburguet commented 1 year ago

Describe the bug After upgrading my GLPI server to 10.0.9, some forms are not working anymore. There is a PHP error in php-errors.log when i press submit on those

and sometimes, it create the ticket, but it appears to be empty for the users and there are no error in phplog Even worth, users can't see some forms even if they are member of a profile sets to have access to them

To Reproduce Steps to reproduce the behavior:

  1. Go to a form
  2. fill it
  3. submit it
  4. fail to submit with an error : image

Expected behavior Form should create a ticket

**GLPI / Plugins formcreator 2.3.16

Full error [2023-07-19 09:28:13] glpiphplog.CRITICAL: *** Uncaught Exception Exception: Infinite loop in show conditions evaluation in /var/www/glpi/marketplace/formcreator/inc/fields.class.php at line 149 Backtrace : ...place/formcreator/inc/formanswer.class.php:1340 PluginFormcreatorFields::isVisible() ...tplace/formcreator/inc/formanswer.class.php:840 PluginFormcreatorFormAnswer->parseTags() src/CommonDBTM.php:1278 PluginFormcreatorFormAnswer->prepareInputForAdd() marketplace/formcreator/ajax/formanswer.php:60 CommonDBTM->add() public/index.php:82 require()

btry commented 1 year ago

Hi

There are several root causes for this error.

btry commented 1 year ago

Hi

Do you have feedback ? Could you examine your impacted form ?

plburguet commented 1 year ago

Hello, The problem is still happening, the error in php-error.log is the same : [2023-08-23 17:21:28] glpiphplog.CRITICAL: *** Uncaught Exception Exception: Infinite loop in show conditions evaluation in /var/www/glpi/marketplace/formcreator/inc/fields.class.php at line 149 Backtrace : ...place/formcreator/inc/formanswer.class.php:1340 PluginFormcreatorFields::isVisible() ...tplace/formcreator/inc/formanswer.class.php:840 PluginFormcreatorFormAnswer->parseTags() src/CommonDBTM.php:1278 PluginFormcreatorFormAnswer->prepareInputForAdd() marketplace/formcreator/ajax/formanswer.php:60 CommonDBTM->add() public/index.php:82 require()

btry commented 1 year ago

Can you check your impacted form ? See my comment of last month. Was the form created by duplicating an other form ?

plburguet commented 1 year ago

Can you check your impacted form ? See my comment of last month. Was the form created by duplicating an other form ?

yes it was a form that was duplicated from another. But the weird thing is that we have 2 glpi. "Environment 1 " : where we duplicated the original form to update it, here both works great, then export. "Environment 2 " : we imported from env1 and it was working until the update to glpi 10 + formcreator 2.13.6

edit : also, env 2 and env 1 are clone (they tend to be different by the time but still)

btry commented 1 year ago

Duplication and import are the same internal process in the plugin.

There was a bug which may be triggered depending on the order of the processing of the components of a form. This order may vary because if the behaviour of MySQL. When you import a form from a Json, there is more probably to trigger the bug. It should be fixed in 2.13.7.

The form in environment 2 is probably corrupted. You must search for inconsistent conditions, linked to question which don't exist in the form. Un the Json file this is visible when the uuid of a question in a condition does not matches any question of the form.

Once found, you must edit the condition to be linked to an other question. You can do it from the UI. There is no automatic solution to fix the corrupted form.

btry commented 1 year ago

I can provide to you a SQL request to identify the corrupted elements. I'll share it tomorrow. Maybe I already shared it in an other issue here. You may search in issues opened after 2023-05-30, as the bug became visible in version 2.13.6

plburguet commented 1 year ago

Okay ! Well we went to an easier solution, to redo the 3 forms from scratch, no need to give us the SQL request to identify those elements. As you fixed the source of the problem, it's good for us for the next time we'll duplicate a form. Thanks a lot