Bug #78267 [Opn->Ver]: Change in sun times result with PHP version change

From: Date: Sat, 13 Jul 2019 15:33:29 +0000
Subject: Bug #78267 [Opn->Ver]: Change in sun times result with PHP version change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221760@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78267&edit=1 ID: 78267 Updated by: cmb@php.net Reported by: stefano dot borghi at gmx dot com Summary: Change in sun times result with PHP version change -Status: Open +Status: Verified Type: Bug Package: Date/time related PHP Version: 7.2.20 Block user comment: N Private report: N New Comment: This[1] has basically been a bug fix, since formerly the time to calculate the Julian Day count has been adjusted to noon, albeit the JD calculation already catered to that, which caused the calculation to be half a day off. For instance, in your example the time was actually calculated for 2018-03-14.5 (i.e. a hypothetical day between the 14th and 15th). Now the time is properly adjusted to midnight. [1] <https://github.com/php/php-src/commit/a063d55395c818c401b7efdf6b42b4728ce3df08> Previous Comments: ------------------------------------------------------------------------ [2019-07-09 19:34:57] stefano dot borghi at gmx dot com Description: ------------ In PHP >= v7.2 the result of the date_sun_info function, and similarly the other sun related functions, return a different value for sunrise and sunset compared to the previous PHP versions. I'm not sure if this is an expected change due to a correction of a previously wrong result or if it's an actual bug. In any case this change is not reported in the documentation. Test script: --------------- // see https://3v4l.org/31aER function sunTimes($lat, $long, $date) { date_default_timezone_set('UTC'); $sun_info = date_sun_info(strtotime($date), $lat, $long); $sunrise = date("H:i:s", $sun_info['sunrise']); $sunset = date("H:i:s", $sun_info['sunset']); return "on $date sun rises at $sunrise and sets at $sunset"; } echo sunTimes(51.5, 0, '2018-03-14'); // ~London Expected result: ---------------- // PHP <= v7.1.0 'on 2018-03-14 sun rises at 06:14:51 and sets at 18:03:16' Actual result: -------------- // PHP >= v7.2.4 'on 2018-03-14 sun rises at 06:15:59 and sets at 18:02:24' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78267&edit=1

« previous php.bugs (#221760) next »