php vrs PHP 8.2.11
I live in Italy (UTC+1), the dst has been deactivated.
I noticed that the day and night icons are offset backwards by 2 hours compared to the actual sunrise and sunset times.
the sun icon appears at 5:00 local time while the moon should appear until 7:00; same thing in the afternoon which displays the moon at 3pm while there should be sun until 5pm.
In wxsim applications there is correctly UTC+1 without DST and in config.php the time zone is set to tzabb = “Europe/Rome”;
Are there maybe some other settings to fix? any ideas to solve this problem?
Thanks in advance
did you remember to uncheck DST in wxsimate and wret as well
yes, already did every where
however, for information, the latest version of the data.php file (adapted for php version 8)
around line 600 is the cause of the anomaly
$arr = date_sun_info((int) $time, $latitude, $latitude); # #### 2022-12-29
$sunrise_epoch = $arr[‘sunrise’]; # date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude,$longitude, $zenith, $offset);
$sunset_epoch = $arr[‘sunset’]; # date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude,$longitude, $zenith, $offset);
if I replace the script with the follow old instructions, the sunrise and sunset icons are displayed correctly and it also works with PHP 8:
$sunrise_epoch = date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude,$longitude, $zenith, $offset);
$sunset_epoch = date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude,$longitude, $zenith, $offset);
I removed those outdated instructions in the scripts for a reason.
Documentation on PHP: date_sunrise - Manual
This function has been DEPRECATED as of PHP 8.1.0. Relying on this function is highly discouraged. Use date_sun_info() instead.
Using date-sunrise can put numerous errors in the logs and eventually the instruction will be removed. But probably that will take some more years.
As the returned times are in UTC, could you try to set the timezone to UTC+1 in ewn/ewn_config.php ?
OK I will try it.