formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

Error when trying to get a question by id apirest.php

Open Wel-lz opened this issue 2 years ago • 0 comments

Describe the bug When trying to receive a question by id, the server returns code 500. The problem occurs if "fieldtype" is equal to "glpiselect" or "dropdown".

Verified endpoints: PluginFormcreatorForm/ PluginFormcreatorSection/ PluginFormcreatorQuestion/

In the case of a request without id (getting a complete list), everything works correctly, but objects are returned without complete information

Logs indicate lack of RAM glpiphplog.CRITICAL: *** PHP Error (1): Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /var/www/glpi/inc/dbmysql.class.php at line 328

I tried to check via Xdebug, the code goes endlessly between glpi/inc/commondbtm.class.php:282 $this->post_getFromDB(); And glpi/marketplace/formcreator/inc/question.class.php:1308 $searchParams = $field->buildParams();

Then it goes somewhere in this direction glpi/marketplace/formcreator/inc/field/dropdownfield.class.php:219 $form->getFromDBByQuestion($this->getQuestion());

To Reproduce 1.Create a form with a dropdown field and a Common-Location value 2.Send a request to glpi.site/apirest.php/PluginFormcreatorForm/<form_id> or glpi.site/apirest.php/PluginFormcreatorQuestion/<question_id> 3. Receive a 500 response code

Expected behavior Be able to get full information about the form/section/question by id if there is a question with the glpiselect or dropdown type in the form

Screenshots image image image

GLPI / Plugins (please complete the following information):

  • GLPI version 9.5.9
  • Formcreator 2.12.7

Desktop (please complete the following information):

  • OS: Windows Pro 10
  • Browser: Google Chrome
  • Postman: 10.19.5

GLPI server OS: Debian GNU/Linux 11 (bullseye) Web server: Apache2 2.4.56 Php: 7.4

Wel-lz avatar Oct 21 '23 02:10 Wel-lz