Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Form import impossible due to formatDefaultValueForDB() return type error

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php
Domain
backend

Research direction

Start at src/Glpi/Form/QuestionType/AbstractQuestionType.php line 56 and trace the call through src/Glpi/Form/Question.php and FormSerializer.php during form import. Reproduce the import with an advancedform LDAP field question, then verify that the default value is handled without the reported return-type error.

Written by the indexing model from the issue text.

Description

Code of Conduct
  • I agree to follow this project's Code of Conduct
Is there an existing issue for this?
  • I have searched the existing issues
GLPI Version

11.0.8

Plugin version

1.1.1

Bug description

Hi,

I'm facing this error when i try to import a form from my test environnement (identical) to prod environnement :
Uncaught PHP Exception TypeError: "Glpi\Form\QuestionType\AbstractQuestionType::formatDefaultValueForDB(): Return value must be of type ?string, array returned" at AbstractQuestionType.php line 56.

Test and prod environnements are the same.
My form has been created under previous GLPI 11.0.7 (without old plugin formcreator).

I've already import previous form without problem but this one use the advancedform list LDAP field questionType.

Thx

Relevant log output
[2026-07-07 07:57:12] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "Glpi\Form\QuestionType\AbstractQuestionType::formatDefaultValueForDB(): Return value must be of type ?string, array returned" at AbstractQuestionType.php line 56
  Backtrace :
  ...i/Form/QuestionType/AbstractQuestionType.php:56 
  ./src/Glpi/Form/Question.php:395                   Glpi\Form\QuestionType\AbstractQuestionType->formatDefaultValueForDB()
  ./src/Glpi/Form/Question.php:278                   Glpi\Form\Question->prepareInput()
  ./src/CommonDBTM.php:1341                          Glpi\Form\Question->prepareInputForAdd()
  ...i/Form/Export/Serializer/FormSerializer.php:628 CommonDBTM->add()
  ...i/Form/Export/Serializer/FormSerializer.php:323 Glpi\Form\Export\Serializer\FormSerializer->importQuestions()
  ...i/Form/Export/Serializer/FormSerializer.php:307 Glpi\Form\Export\Serializer\FormSerializer->doImportFormFormSpecs()
  ...i/Form/Export/Serializer/FormSerializer.php:254 Glpi\Form\Export\Serializer\FormSerializer->importFormFromSpec()
  ...oller/Form/Import/Step4ExecuteController.php:75 Glpi\Form\Export\Serializer\FormSerializer->importFormsFromJson()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\Form\Import\Step4ExecuteController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:71                              Symfony\Component\HttpKernel\Kernel->handle()
Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

GLPI 11.0.8
PHP: 8.5.8 fpm-fcgi
Web server: Apache/2.4.67 (Debian) ()
Database: 10.11.14-MariaDB-0+deb12u2-log

Anything else?

No response

Dominant language
PHP
Stars
4
Forks
4
Avg merge
7d 7h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pluginsGLPI/advancedforms

All issues in pluginsGLPI/advancedforms

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.