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

DataUnitConversion.php error with PHP 8.2 #33

Open
lahyenne opened this issue Aug 7, 2023 · 2 comments · Fixed by #34
Open

DataUnitConversion.php error with PHP 8.2 #33

lahyenne opened this issue Aug 7, 2023 · 2 comments · Fixed by #34
Assignees
Labels
[Needs] Dev [Needs] Testing [Priority] Low [Status] In Progress Tracking issues with work in progress [Type] Bug Something isn't working
Milestone

Comments

@lahyenne
Copy link

lahyenne commented Aug 7, 2023

functions like this one in the file /wp-content/plugins/live-weather-station/includes/traits/DataUnitConversion.php :

protected function get_wind_angle($value)
    {
        $result = $value;
        return sprintf('%d', round($result, 0));
    }

throw an error in PHP 8.2 (it works fine in PHP 7.4) when $result='NULL' when executing the round command.
I run a test with the following modification, and it works for me (maybe not the best) :

protected function get_wind_angle($value)
	{
    // Convert non-numeric values to 0
    $result = is_numeric($value) ? $value : 0;

    // Round the numeric value
    return sprintf('%d', round($result, 0));
	}
@jaz-on jaz-on added this to the 3.8.14 milestone Aug 8, 2023
@jaz-on jaz-on self-assigned this Aug 8, 2023
jaz-on added a commit to jaz-on/live-weather-station that referenced this issue Aug 8, 2023
@jaz-on jaz-on closed this as completed in #34 Aug 8, 2023
jaz-on added a commit that referenced this issue Aug 8, 2023
@jaz-on
Copy link
Member

jaz-on commented Aug 8, 2023

Hello @lahyenne thanks for the feedback. The Weather Station plugin hasn't been tested up to PHP 8.2 yet.
In fact, I guess the whole codebase has been developed when PHP 7.x was the current version, I guess the whole codebase will have to be tested for PHP 8.x.

I committed and merged a fix. This needs to be tested as part of the future 3.8.14 version (FYI the review and validation of 3.8.13 is pending on WordPress.org).

@jaz-on jaz-on reopened this Aug 8, 2023
@jaz-on jaz-on added the [Status] In Progress Tracking issues with work in progress label Aug 8, 2023
@jaz-on
Copy link
Member

jaz-on commented Sep 6, 2023

@lahyenne I just released version 3.8.14, would you mind testing it and providing feedback if it resolves the error you reported? Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Needs] Dev [Needs] Testing [Priority] Low [Status] In Progress Tracking issues with work in progress [Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants