pluginsGLPI / genericobject

Genericobject object plugin
http://glpi-plugins.rtfd.io/en/latest/genericobject/index.html
GNU General Public License v3.0
54 stars 60 forks source link

fix(core): prevent uasort(): Argument #1 () must be of type array, null given #359

Closed stonebuzz closed 1 year ago

stonebuzz commented 1 year ago

Prevent this

[2023-09-15 14:28:05] glpiphplog.CRITICAL:   *** Uncaught Exception TypeError: uasort(): Argument #1 ($array) must be of type array, null given in /mnt/diskhome/home/htdocs/marketplace/genericobject/inc/object.class.php at line 1264
  Backtrace :
  ...etplace/genericobject/inc/object.class.php:1264 uasort()
  src/Html.php:1454                                  PluginGenericobjectObject::getMenuContent()
  src/Html.php:1681                                  Html::generateMenuSession()
  front/central.php:82                               Html::header()

When no family or object has been created (i.e. from installation)

A release will become essential

AdrienClairembault commented 1 year ago

If $types is empty, $menu wont be initialized and the same error will probably happen. It seems that $menu should be initialized at the very start of the function.

AdrienClairembault commented 1 year ago

Looks good after 1eaca858e912c45e07922c1fcfc02ed2e658e955.