pluginsGLPI / fields

Additionals fields for GLPI
http://glpi-plugins.rtfd.io/en/latest/fields/index.html
GNU General Public License v2.0
90 stars 67 forks source link

Bug: injection class template generates deprecated call to get_parent_class() (as of PHP 8.3) #838

Closed bborrel closed 1 month ago

bborrel commented 1 month ago

Call to get_parent_class() in injection.class.php is deprecated as of PHP 8.3.

Indeed, as per PHP documentation on get_parent_class():

Calling get_parent_class() without an argument now emits an E_DEPRECATED warning; previously, calling this function inside a class returned the name of that class.

Proposed solution

Simply add __CLASS__ (not $this, since caller is static) as parameter when calling method get_parent_class() in injection.class.php:

static function getTable($classname = null) {
    return getTableForItemType(get_parent_class(__CLASS_));
}

Then, one need to regenerate the container files, either via:

See corresponding issue #422 on plugin Data Injection repository.