Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple deprecation warnings #553

Open
lucagubler opened this issue Aug 27, 2024 · 1 comment
Open

Multiple deprecation warnings #553

lucagubler opened this issue Aug 27, 2024 · 1 comment

Comments

@lucagubler
Copy link

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:

  • Passing null to hex2bin() in ObjectsController.php on line 61.
  • Return type issues in jsonSerialize() within ResourceUsage.php.

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

  • VMware vCenter®/ESXi™-Version: VMware ESXi 8.0.3
  • Version/GIT-Hash of this module: f093fd7
  • Icinga Web 2 version: 2.12.1
  • Operating System and version: Ubuntu 22.04.4 LTS
  • Webserver, PHP versions: PHP 8.1, Apache/2.4.52
@lucagubler
Copy link
Author

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:

  • Bump the version and release a new version that includes the latest fixes (e.g. v1.7.2)
  • Modify the install script to pull from the master branch until a new version is officially released.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant