TypeError in search on GLPI 12: "Tags - Entity" search option uses a string join condition
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 90/100
Línea de trabajo
Abre hook.php y localiza plugin_tag_getAddSearchOptionsNew(), en concreto la opción de búsqueda con id 10501 y su joinparams condition establecido en la cadena "AND 1=1". Reemplázala por un \Glpi\DBAL\QueryExpression envuelto en un array tal como muestra el diff sugerido en el issue, conservando el comentario que explica por qué existe la condición. Verifica añadiendo la columna "Tags - Entity" a la lista de tickets en una instancia GLPI 12 y comprobando que no aparece ningún TypeError de analyseCrit(); revisa si hay pruebas del plugin o una entrada de CHANGELOG que actualizar.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
After upgrading to GLPI 12.0.0 with tag 2.15.0, every search that includes the "Tags - Entity" search option (id 10501) fails. This breaks the ticket list, dashboard cards based on saved searches, and saved search alerts (cron).
GLPI 12 no longer accepts a raw SQL string as join condition: DBmysqlIterator::analyseCrit() is now typed array $crit.
Steps to reproduce
- GLPI 12.0.0, tag plugin 2.15.0
- Add the "Tags - Entity" column (search option
10501) to the Ticket list display - Open the ticket list (or any dashboard card / saved search on Ticket)
Error
glpi.CRITICAL: *** Uncaught PHP Exception TypeError: "DBmysqlIterator::analyseCrit(): Argument #1 ($crit) must be of type array, string given, called in ./src/DBmysqlIterator.php on line 602"
./src/DBmysqlIterator.php:602 DBmysqlIterator->analyseCrit()
./src/DBmysqlIterator.php:820 DBmysqlIterator->analyseCrit()
./src/DBmysqlIterator.php:612 DBmysqlIterator->analyseFkey()
./src/DBmysqlIterator.php:767 DBmysqlIterator->analyseCrit()
./src/DBmysqlIterator.php:327 DBmysqlIterator->analyseJoins()
./src/Glpi/DBAL/Parts/BasePart.php:64 DBmysqlIterator->buildQuery()
./src/Search.php:710 Glpi\DBAL\Parts\BasePart->withCriteria()
./src/Glpi/Search/Provider/SQLProvider.php:4867 Search::addLeftJoin()
./src/Search.php:263 Glpi\Search\Provider\SQLProvider::constructSQL()
./src/SavedSearch.php:1154 Search::constructSQL()
Cause
hook.php, in plugin_tag_getAddSearchOptionsNew():
'joinparams' => [
'condition' => "AND 1=1", // to force distinct complex id than the previous option
Suggested fix
Use an array condition, which keeps the distinct complex id while matching the GLPI 12 API:
- 'condition' => "AND 1=1", // to force distinct complex id than the previous option
+ 'condition' => [new \Glpi\DBAL\QueryExpression('1=1')], // to force distinct complex id than the previous option
We applied this patch locally: the ticket list and dashboard cards work again.
Environment
- GLPI 12.0.0 (official Docker image
ghcr.io/glpi-project/glpi:12.0.0) - tag 2.15.0
- PHP 8.x, MariaDB 11.8
- Lenguaje dominante
- PHP
- Estrellas
- 29
- Forks
- 26
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 10
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pluginsGLPI/tag
-
Tag column label is incorrectly prefixed by Carbon plugin labelPosiblemente ocupada @btry la tomó hace 7 días. Abiertobug
pluginsGLPI/tag#383 · 5 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de pluginsGLPI/tag
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
PrestaShop/PrestaShop#43140 ·
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 3 días
-
[Bug] Report tables drop a metric's trailing zeros and cap it at two decimalsPosiblemente ocupada @lansow la tomó hoy. AbiertoPotential Bug triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
matomo-org/matomo#25474 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
coollabsio/shoutrrr#190 ·