-
Notifications
You must be signed in to change notification settings - Fork 4
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
Issue with Conversions #8
Comments
@trrisner which php version it doesn't work and can you give me example metar raw that is not working for ? |
PHP v8.2.21 is the version. |
@trrisner I tried to repliocate it in many different phps, just created simple script and I don't see it's an issue:
|
Interesting. Fatal error: Uncaught TypeError: Unsupported operand types: string * int in $YOURSCRIPT:1042 If I simply change Just wanted it in here in case someone else runs into the issue. |
For some reason i think the parser working bad and getting something more than just distance (maybe there is something else in the field, which mean to get that error i would need to get RAW METAR to see where is culprit instead of just mapping it to (float). |
with updated php(s), the string * float or string * int equations won't work.
You have to convert all strings like wind speed or temperature to a float or an int to get the conversions to work.
Otherwise it kicks out to a fatal error.
Change
$windspeed = round(2.23694 * $this->result['wind_speed']); // convert m/s to mi/h
to
$windspeed = round(2.23694 * (float)$this->result['wind_speed']); // convert m/s to mi/h
AND
return round($conversion_factor * $speed, 2);
to
return round((float)$conversion_factor * (float)$speed, 2);
and all other occurrences in the script to get the code to work.
The text was updated successfully, but these errors were encountered: