Icinga / icingaweb2-module-vspheredb

The easiest way to monitor a VMware vSphere environment.
https://icinga.com/docs/vsphere/latest
GNU General Public License v2.0
100 stars 34 forks source link

Multiple deprecation warnings #553

Open lucagubler opened 2 weeks ago

lucagubler commented 2 weeks ago

Expected Behavior

The Vspheredb module should work without deprecation warnings in PHP 8.1 and later versions, with proper type handling for functions such as hex2bin() and jsonSerialize().

Current Behavior

Several deprecation warnings appear when using the Vspheredb module with PHP 8.1 due to stricter type-checking. These include:

Possible Solution

To resolve these warnings:

  1. Add proper null checks before passing values to functions like hex2bin().
  2. Update methods like jsonSerialize() to explicitly declare the return type (e.g., mixed) or suppress the warnings using the #[\ReturnTypeWillChange] attribute.

I plan to address these issues myself and will provide a pull request once resolved.

Steps to Reproduce (for bugs)

  1. Upgrade to PHP 8.1.
  2. Use the Vspheredb module within Icinga Web 2.
  3. Trigger actions that involve the ObjectsController and ResourceUsage classes.
  4. Observe the deprecation warnings in the logs.

Your Environment

lucagubler commented 2 weeks ago

I just realized that the issue has already been fixed in the repository, but the problem is that the fix has not been included in an official release yet. The script provided for installing the latest version currently points to version v1.7.1, which doesn't include the fixes for the deprecation warnings in PHP 8.1.

I believe all that's needed here is to either:

Thanks!