Skip to content

Fix: search crash on duplicate field names#1222

Merged
Rom1-B merged 1 commit into
mainfrom
support_45192
Jul 9, 2026
Merged

Fix: search crash on duplicate field names#1222
Rom1-B merged 1 commit into
mainfrom
support_45192

Conversation

@Rom1-B

@Rom1-B Rom1-B commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !45192
  • Two containers can legitimately define a dropdown field with the same name, so both share the same underlying dropdown table.
  • Searching on the related itemtype then crashed with a Twig runtime error, because the plugin looked up the field by name instead of by its unique id, and the lookup found two matching rows instead of one.
An exception thrown during rendering template ("`PluginFieldsField::getFromDBByCrit()` expects get one result, 2 found in query "SELECT `id` FROM `glpi_plugin_fields_fields` WHERE `name` = 'accessoirefield' AND `multiple` = '1'".") in "pages/generic_list.html.twig" line 37.
  • The field is now identified by its id, which is already computed when the search options are built and used elsewhere in the plugin for the same purpose.

Screenshots (if appropriate):

@Rom1-B Rom1-B requested a review from stonebuzz July 9, 2026 06:22

@stonebuzz stonebuzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rom1-B Rom1-B merged commit 195ae58 into main Jul 9, 2026
3 checks passed
@Rom1-B Rom1-B deleted the support_45192 branch July 9, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants