glpi icon indicating copy to clipboard operation
glpi copied to clipboard

Error when deleting an asset created through Asset Definition

Open rean1mat0r opened this issue 2 months ago • 2 comments

Code of Conduct

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

Is there an existing issue for this?

  • [ ] I have searched the existing issues

Version

11.0.4

Bug description

1.Created a test asset. 2.I tried to delete it 3.I got an error

Relevant log output

[2025-12-07 23:18:50] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, stdClass given" at HasImpactCapacity.php line 139
  Backtrace :
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 in_array()
  ./src/Glpi/Asset/AssetDefinition.php:443           Glpi\Asset\Capacity\HasImpactCapacity->onCapacityDisabled()
  ./src/Glpi/Asset/AssetDefinition.php:408           Glpi\Asset\AssetDefinition->onCapacityDisabled()
  ./src/CommonDBTM.php:840                           Glpi\Asset\AssetDefinition->cleanDBonPurge()
  ./src/CommonDBTM.php:2183                          CommonDBTM->deleteFromDB()
  ./front/asset/assetdefinition.form.php:102         CommonDBTM->delete()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

Page URL

No response

Steps To reproduce

1.Created a test asset. 2.I tried to delete it 3.I got an error

Your GLPI setup information

GLPI information
GLPI: 11.0.4 ( => /var/www/itsm.filial-fnkc)
Installation mode: TARBALL
Current language: ru_RU
Source Integrity: OK
Server
Operating system: Linux Server-ITSM 6.14.0-36-generic #​36~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 15 15:45:17 UTC 2 x86_64

PHP: 8.3.6 fpm-fcgi

PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, imap, intl, ldap, exif, mcrypt, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache

Setup: disable_functions="" max_execution_time="6000000" max_input_vars="1000" memory_limit="2048M" post_max_size="2G" session.cookie_secure="0" session.cookie_httponly="1" session.cookie_samesite="" session.save_handler="files" upload_max_filesize="10G"

Web server: Apache/2.4.58 (Ubuntu) (Apache/2.4.58 (Ubuntu) Server at itsm.filial-fnkc Port 80)

User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0

Database:

Server Software: Ubuntu 24.04

Server Version: 10.11.13-MariaDB-0ubuntu0.24.04.1

Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Parameters: sqladmin@localhost/itsm_filial_fnkc_db

Host info: Localhost via UNIX socket

Requirements: PHP version (8.3.6) is supported. OS and PHP are relying on 64 bits integers. Sessions configuration is OK. Allocated memory is sufficient. Following extensions are installed: dom, fileinfo, filter, libxml, simplexml, tokenizer, xmlreader, xmlwriter. mysqli extension is installed curl extension is installed gd extension is installed intl extension is installed mbstring extension is installed zlib extension is installed bcmath extension is installed The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. openssl extension is installed Database engine version (10.11.13) is supported. The log file has been created successfully. Write access to /var/lib/glpi/files/_cache has been validated. Write access to /var/lib/glpi/files/_cron has been validated. Write access to /var/lib/glpi/files has been validated. Write access to /var/lib/glpi/files/_graphs has been validated. Write access to /var/lib/glpi/files/_lock has been validated. Write access to /var/lib/glpi/files/_pictures has been validated. Write access to /var/lib/glpi/files/_plugins has been validated. Write access to /var/lib/glpi/files/_rss has been validated. Write access to /var/lib/glpi/files/_sessions has been validated. Write access to /var/lib/glpi/files/_tmp has been validated. Write access to /var/lib/glpi/files/_uploads has been validated.

Sessions configuration is secured. exif extension is installed ldap extension is installed Following extensions are installed: bz2, Phar, zip. Zend OPcache extension is installed Following extensions are installed: ctype, iconv, sodium. Write access to /var/www/itsm.filial-fnkc/marketplace has been validated. Timezones seems loaded in database.

GLPI constants
GLPI_ROOT: "/var/www/itsm.filial-fnkc"
GLPI_VERSION: "11.0.4"
GLPI_SCHEMA_VERSION: "11.0.4@9065df1ff6b8ff1d77b519d1c4856507d18258b0"
GLPI_FILES_VERSION: "11.0.4-1d4fbe9a"
GLPI_MIN_PHP: "8.2"
GLPI_MAX_PHP: "8.5"
GLPI_YEAR: "2025"
GLPI_I18N_DIR: "/var/www/itsm.filial-fnkc/locales"
GLPI_VAR_DIR: "/var/lib/glpi/files"
GLPI_LOG_DIR: "/var/log/glpi"
GLPI_ENVIRONMENT_TYPE: "production"
GLPI_CONFIG_DIR: "/var/www/itsm.filial-fnkc/config"
GLPI_MARKETPLACE_DIR: "/var/www/itsm.filial-fnkc/marketplace"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["~^\n                        (http|https|feed)://
# protocol\n (\n (?:\n
(?:xn--[a-z0-9-]++\.)+xn--[a-z0-9-]++ # a domain name using punycode\n
|\n (?:[\pL\pN\pS\pM\-\]++\.)+[\pL\pN\pM]++ # a multi-level domain name\n |\n [a-z0-9\-\]++
# a single-level domain name\n )\.?\n |
# or\n \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
# an IP address\n | # or\n \[\n
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))\n \] # an IPv6 address\n
)\n (?:/ (?:[\pL\pN\pS\pM\-._\~!$&'()
+,;=:@]|%[0-9A-Fa-f]{2})* )* # a path\n
(?:\? (?:[\pL\pN\-._\~!$&'\\+,;=:@/?]|%[0-9A-Fa-f]{2}) )? # a query (optional)\n
$~ixuD"] GLPI_DISALLOWED_UPLOADS_PATTERN: "/\.(php\d*|phar)$/i" GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org" GLPI_INSTALL_MODE: "TARBALL" GLPI_NETWORK_MAIL: "[email protected]" GLPI_NETWORK_SERVICES: "https://services.glpi-network.com" GLPI_MARKETPLACE_ENABLE: 3 GLPI_MARKETPLACE_PRERELEASES: false GLPI_MARKETPLACE_ALLOW_OVERRIDE: true GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true GLPI_USER_AGENT_EXTRA_COMMENTS: "" GLPI_DOCUMENTATION_ROOT_URL: "https://links.glpi-project.org" GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1" GLPI_LOG_LVL: "warning" GLPI_SKIP_UPDATES: false GLPI_STRICT_ENV: false GLPI_AJAX_DASHBOARD: "1" GLPI_CALDAV_IMPORT_STATE: 0 GLPI_CENTRAL_WARNINGS: "1" GLPI_SYSTEM_CRON: false GLPI_TEXT_MAXSIZE: "4000" GLPI_WEBHOOK_ALLOW_RESPONSE_SAVING: "0" GLPI_WEBHOOK_CRA_MANDATORY: false GLPI_ALTCHA_MODE: "interactive" GLPI_ALTCHA_MAX_NUMBER: 50000 GLPI_ALTCHA_EXPIRATION_INTERVAL: "PT20M" GLPI_DOC_DIR: "/var/lib/glpi/files" GLPI_CACHE_DIR: "/var/lib/glpi/files/_cache" GLPI_CRON_DIR: "/var/lib/glpi/files/_cron" GLPI_GRAPH_DIR: "/var/lib/glpi/files/_graphs" GLPI_LOCAL_I18N_DIR: "/var/lib/glpi/files/_locales" GLPI_LOCK_DIR: "/var/lib/glpi/files/_lock" GLPI_PICTURE_DIR: "/var/lib/glpi/files/_pictures" GLPI_PLUGIN_DOC_DIR: "/var/lib/glpi/files/_plugins" GLPI_RSS_DIR: "/var/lib/glpi/files/_rss" GLPI_SESSION_DIR: "/var/lib/glpi/files/_sessions" GLPI_TMP_DIR: "/var/lib/glpi/files/_tmp" GLPI_UPLOAD_DIR: "/var/lib/glpi/files/_uploads" GLPI_INVENTORY_DIR: "/var/lib/glpi/files/_inventories" GLPI_THEMES_DIR: "/var/lib/glpi/files/_themes" GLPI_PLUGINS_DIRECTORIES: ["/var/www/itsm.filial-fnkc/marketplace","/var/www/itsm.filial-fnkc/plugins"] GLPI_NETWORK_API_URL: "https://services.glpi-network.com/api" GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/" GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
Plugins list
fields               Name: Additional fields              Version: 1.23.1     State: Включен                           Install
Method: Marketplace
advancedplanning     Name: advancedplanning               Version: 1.1.1      State: Установлен / не активирован Install Method:
Marketplace
archisw              Name: Apps structures                Version: 3.0.24     State: Установлен / не активирован Install Method:
Marketplace
archibp              Name: Business Processes             Version: 2.0.13     State: Установлен / не активирован Install Method:
Marketplace
positions            Name: Cartography                    Version: 7.0.2      State: Включен                           Install
Method: Marketplace
connections          Name: Connections                    Version: 10.0.0     State: Установлен / не активирован Install Method:
Marketplace
archimap             Name: Diagrams                       Version: 3.3.8      State: Включен                           Install
Method: Marketplace
formcreator          Name: Form Creator                   Version: 2.13.10    State: Установлен / не активирован Install Method:
Marketplace
archifun             Name: Functional Areas               Version: 2.3.2      State: Установлен / не активирован Install Method:
Marketplace
genericobject        Name: Generic Objects End-of-Life Up Version: 3.0.2      State: Установлен / не активирован Install Method:
Marketplace
glpiinventory        Name: GLPI Inventory                 Version: 1.6.4      State: Включен                           Install
Method: Marketplace
addressing           Name: IP Addressing                  Version: 3.1.1      State: Включен                           Install
Method: Marketplace
statecheck           Name: Statecheck Rules               Version: 2.4.7      State: Установлен / не активирован Install Method:
Marketplace
tag                  Name: Tag Management                 Version: 2.14.2     State: Включен                           Install
Method: Marketplace
useditemsexport      Name: Used items export              Version: 2.5.2      State: Установлен / не активирован Install Method:
Marketplace
webresources         Name: Web Resources                  Version: 2.0.4      State: Не установленный          Install Method:
Marketplace
additionalalerts     Name: Другие уведомления      Version: 2.4.0      State: Не установленный          Install Method:
Marketplace
news                 Name: Оповещения                     Version: 1.12.5     State: Установлен / не активирован Install Method:
Marketplace
pdf                  Name: Печать в PDF                   Version: 4.0.2      State: Установлен / не активирован Install Method:
Marketplace
mreporting           Name: Подробные отчеты          Version: 1.8.9      State: Установлен / не активирован Install Method:
Marketplace

Anything else?

No response

rean1mat0r avatar Dec 07 '25 20:12 rean1mat0r

It is noticed that the error starts when the created asset has something selected on the "Capacities" tab. I tried it with "Impact analysis" enabled.

I also noticed that my errors start the moment I turn on Impact analysis and click Save, and the same thing happens when I remove it and click save.

`[2025-12-07 23:30:43] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, stdClass given" at HasImpactCapacity.php line 139
  Backtrace :
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 in_array()
  ./src/Glpi/Asset/AssetDefinition.php:443           Glpi\Asset\Capacity\HasImpactCapacity->onCapacityDisabled()
  ./src/Glpi/Asset/AssetDefinition.php:408           Glpi\Asset\AssetDefinition->onCapacityDisabled()
  ./src/CommonDBTM.php:840                           Glpi\Asset\AssetDefinition->cleanDBonPurge()
  ./src/CommonDBTM.php:2183                          CommonDBTM->deleteFromDB()
  ./front/asset/assetdefinition.form.php:102         CommonDBTM->delete()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

[2025-12-07 23:33:53] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, stdClass given" at HasImpactCapacity.php line 139
  Backtrace :
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 in_array()
  ./src/Glpi/Asset/AssetDefinition.php:443           Glpi\Asset\Capacity\HasImpactCapacity->onCapacityDisabled()
  ./src/Glpi/Asset/AssetDefinition.php:394           Glpi\Asset\AssetDefinition->onCapacityDisabled()
  ./src/CommonDBTM.php:1817                          Glpi\Asset\AssetDefinition->post_updateItem()
  ./front/asset/assetdefinition.form.php:90          CommonDBTM->update()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

[2025-12-07 23:34:23] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, stdClass given" at HasImpactCapacity.php line 126
  Backtrace :
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:126 
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:126 in_array()
  ./src/Glpi/Asset/AssetDefinition.php:428           Glpi\Asset\Capacity\HasImpactCapacity->onCapacityEnabled()
  ./src/Glpi/Asset/AssetDefinition.php:389           Glpi\Asset\AssetDefinition->onCapacityEnabled()
  ./src/CommonDBTM.php:1817                          Glpi\Asset\AssetDefinition->post_updateItem()
  ./front/asset/assetdefinition.form.php:90          CommonDBTM->update()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

[2025-12-07 23:34:31] glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, stdClass given" at HasImpactCapacity.php line 139
  Backtrace :
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 
  ...c/Glpi/Asset/Capacity/HasImpactCapacity.php:139 in_array()
  ./src/Glpi/Asset/AssetDefinition.php:443           Glpi\Asset\Capacity\HasImpactCapacity->onCapacityDisabled()
  ./src/Glpi/Asset/AssetDefinition.php:394           Glpi\Asset\AssetDefinition->onCapacityDisabled()
  ./src/CommonDBTM.php:1817                          Glpi\Asset\AssetDefinition->post_updateItem()
  ./front/asset/assetdefinition.form.php:90          CommonDBTM->update()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()`

rean1mat0r avatar Dec 07 '25 20:12 rean1mat0r

Just tested, I cannot reproduce.

trasher avatar Dec 08 '25 06:12 trasher