glpi icon indicating copy to clipboard operation
glpi copied to clipboard

[main] Twig Error in template "templates/pages/setup/webhook/webhook.html.twig"

Open flegastelois opened this issue 1 year ago • 1 comments

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

main

Bug description

Twig Error (Twig\Error\RuntimeError): "An exception has been thrown during the rendering of a template ("Class name must be a valid object or a string")." in template "glpi-core/main/htdocs/templates/pages/setup/webhook/webhook.html.twig" at line 45

image

This seems to be happening since this commit d75c417cd8fafb04c7e6ca902f2339f4580c2f65

Webhook::getAPIItemtypeData no longer returns the same array.

Example before the mentionned commit: Capture d’écran du 2024-09-11 17-32-18

After the mentionned commit: Capture d’écran du 2024-09-11 17-29-13

Notice the "10 > Glpi\CustomeAsset\Voiture", which must certainly be the cause of the error generated (10 not being an itemtype)

Relevant log output

No response

Page URL

front/webhook.form.php

Steps To reproduce

To reproduce the bug, you need to have a generic object (created from front/asset/assetdefinition.php). Once you have a generic object, just go to the webhook creation page.

Your GLPI setup information

No response

Anything else?

No response

flegastelois avatar Sep 11 '24 15:09 flegastelois

Preview tab of a existing webhook is broken also with the same error

orthagh avatar Sep 13 '24 08:09 orthagh

Is this still an issue? Custom assets aren't valid itemtypes for webhooks anymore since they aren't supported by the new API yet. They were only available in error when using itemtypes directly from the asset_types array instead of a more controlled list.

cconard96 avatar Dec 04 '24 21:12 cconard96

I am not able to reproduce. Generic assets are not anymore listed in webhooks and therefore this issue is not relevant anymore.

cedric-anne avatar Mar 05 '25 16:03 cedric-anne