Skip to content

Exception after GLPI 11 RC2 update - Argument #1 ($raw_joins) must be of type string, array given in SQLProvider.php #990

@husisusi

Description

@husisusi

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

GLPI 11 rc2

Plugin version

1.22.0-beta2

Bug description

After updating to GLPI 11 RC2, an exception is being thrown during the rendering of the generic_list.html.twig template. The error occurs in the SQLProvider::parseJoinString() method, where the first argument ($raw_joins) is expected to be a string, but an array is being passed instead. This issue appears to be related to the plugin "Fields".

Steps to Reproduce:

Update GLPI to version 11 RC2.

Ensure the "Fields" plugin is enabled and configured.

Access the generic_list.html.twig page (or any page utilizing SQL joins with the plugin).

The exception is thrown as a result.

Expected Behavior:
The page should render correctly without errors, and no exception should be thrown.

Actual Behavior:
The following exception is thrown:

An exception has been thrown during the rendering of a template ("Glpi\Search\Provider\SQLProvider::parseJoinString(): Argument #1 ($raw_joins) must be of type string, array given, called in ./src/Glpi/Search/Provider/SQLProvider.php on line 2848") in "pages/generic_list.html.twig" at line 37.

Stack Trace:

In ./src/Glpi/Search/Provider/SQLProvider.php(2663)
#0 ./src/Glpi/Search/Provider/SQLProvider.php(2848): Glpi\Search\Provider\SQLProvider::parseJoinString()
#1 ./src/Search.php(720): Glpi\Search\Provider\SQLProvider::getLeftJoinCriteria()
#2 ./src/Glpi/Search/Provider/SQLProvider.php(4183): Search::addLeftJoin()
#3 ./src/Glpi/Search/SearchEngine.php(656): Glpi\Search\Provider\SQLProvider::constructSQL()
#4 ./src/Glpi/Search/SearchEngine.php(672): Glpi\Search\SearchEngine::getData()
#5 ./src/Glpi/Search/SearchEngine.php(629): Glpi\Search\SearchEngine::showOutput()
#6 [internal function]: Glpi\Search\SearchEngine::show()
#7 ./src/Glpi/Application/View/Extension/PhpExtension.php(93): call_user_func_array()
#8 ./files/_cache/11.0.0-rc2-040d3081-production/templates/26/261cdf48e21cbd3217b514b88e1621a0.php(55): Glpi\Application\View\Extension\PhpExtension->call()
#9 ./vendor/twig/twig/src/Template.php(402): __TwigTemplate_cfad014b18affc2a8081a995b8e7464d->doDisplay()
#10 ./vendor/twig/twig/src/Template.php(358): Twig\Template->yield()
#11 ./vendor/twig/twig/src/Template.php(373): Twig\Template->display()
#12 ./vendor/twig/twig/src/TemplateWrapper.php(51): Twig\TemplateWrapper->render()
#13 ./src/Glpi/Application/View/TemplateRenderer.php(168): Twig\TemplateWrapper->render()
#14 ./src/Glpi/Controller/AbstractController.php(68): Glpi\Application\View\TemplateRenderer->render()
#15 ./src/Glpi/Controller/GenericListController.php(51): Glpi\Controller\AbstractController->render()
#16 ./vendor/symfony/http-kernel/HttpKernel.php(181): Glpi\Controller\GenericListController->__invoke()
#17 ./vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#18 ./vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle()
#19 ./public/index.php(70): Symfony\Component\HttpKernel\Kernel->handle()
#20 {main}

GLPI Version:

GLPI 11 RC2

Plugin(s) Involved:

Fields Plugin

Additional Notes:

The issue may be related to how SQL joins are constructed in the SQLProvider when the Fields plugin is enabled.

The plugin may be passing an array instead of a string to the parseJoinString() method.

Suggested Fix:
Ensure that the argument passed to SQLProvider::parseJoinString() is always a string. This might involve updating the plugin to align with the changes introduced in GLPI 11 RC2 or making adjustments in the SQLProvider.php file to handle array inputs.

Possible Workaround:
Temporarily disable the "Fields" plugin until a fix is available.

Relevant log output

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions