You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the problem is in the call function timelib_astro_rise_set_altitude() in /ext/date/php_date.c
Back in PHP 7.4.33 it was called like this
timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); https://github.com/php/php-src/blob/PHP-7.4.33/ext/date/php_date.c#L5146
The fourth parameter, -35.0/60, is the refraction value in degrees.
In the timelib_astro_rise_set_altitude() function then subtracts the calculated apparent radius of the Sun (which is approximately 15.0/60) https://github.com/php/php-src/blob/PHP-7.4.33/ext/date/lib/astro.c#L260 (the variable upper_limb is always 1)
The result is the correct topocentric altitude (-50/60 degrees) needed to calculate the sunrise and sunset times.
However, since PHP 8, it is called timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); https://github.com/php/php-src/blob/PHP-8.0/ext/date/php_date.c#L4663
The fourth parameter, -50.0/60, is refraction and apparent radius together. But in the function itself, the subtraction of the calculated apparent radius of the Sun is still done.
The resulting topocentric altitude (-65/60 degrees) is wrong and consequently so are the calculated sunrise and sunset times. The other calculated times (transit and *twilight*) are correct.
PHP Version
PHP 8.3.17
Operating System
No response
The text was updated successfully, but these errors were encountered:
Description
The following code:
Resulted in this output PHP 7.4 (compare https://aa.usno.navy.mil/calculated/rstt/oneday?date=2025-03-21&lat=51.48&lon=0.0000&label=&tz=0.00&tz_sign=1&tz_label=false&dst=false&submit=Get+Data):
Resulted in this output PHP 8.3.17:
I think the problem is in the call function timelib_astro_rise_set_altitude() in /ext/date/php_date.c
Back in PHP 7.4.33 it was called like this
timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
https://github.com/php/php-src/blob/PHP-7.4.33/ext/date/php_date.c#L5146
The fourth parameter, -35.0/60, is the refraction value in degrees.
In the timelib_astro_rise_set_altitude() function then subtracts the calculated apparent radius of the Sun (which is approximately 15.0/60)
https://github.com/php/php-src/blob/PHP-7.4.33/ext/date/lib/astro.c#L260 (the variable upper_limb is always 1)
The result is the correct topocentric altitude (-50/60 degrees) needed to calculate the sunrise and sunset times.
However, since PHP 8, it is called timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
https://github.com/php/php-src/blob/PHP-8.0/ext/date/php_date.c#L4663
The fourth parameter, -50.0/60, is refraction and apparent radius together. But in the function itself, the subtraction of the calculated apparent radius of the Sun is still done.
The resulting topocentric altitude (-65/60 degrees) is wrong and consequently so are the calculated sunrise and sunset times. The other calculated times (transit and *twilight*) are correct.
PHP Version
PHP 8.3.17
Operating System
No response
The text was updated successfully, but these errors were encountered: