Bug #80963 [Csd]: DateTimeZone::getTransitions() truncated
| From: | thekid@php.net | Date: | Wed, 22 Sep 2021 15:07:18 +0000 |
| Subject: | Bug #80963 [Csd]: DateTimeZone::getTransitions() truncated | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236754@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80963&edit=1
ID: 80963
Updated by: thekid@php.net
Reported by: thekid@php.net
Summary: DateTimeZone::getTransitions() truncated
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Windows
PHP Version: master-Git-2021-04-17 (Git)
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Sorry for the missing feedback - I retested this and verified it works again as expected, see https://github.com/xp-framework/core/issues/268.
Thanks Derick!
Previous Comments:
------------------------------------------------------------------------
[2021-09-22 09:46:29] cmb@php.net
> The fix for this bug has been committed.
So this ticket can be closed.
------------------------------------------------------------------------
[2021-08-08 16:28:04] derick@php.net
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.
Fixed for 8.1.0beta3.
------------------------------------------------------------------------
[2021-08-08 16:27:42] git@php.net
Automatic comment on behalf of derickr
Revision: https://github.com/php/php-src/commit/d9c8e5a42e2f593319ce7b682d43f1f6eb42512e
Log: Fixed bug #80963: DateTimeZone::getTransitions() truncated
------------------------------------------------------------------------
[2021-04-18 13:52:44] derick@php.net
This is a tricky one. The data format that the library uses has changed, and will now only contain a
list of transitions up until the last time the *rules* changed.
For America/New_York, that was in 2007, and Europe/London, in 1996. Beyond that, the timelib library
now can calculate the offset for a specific timestamp: https://github.com/derickr/timelib/blob/master/parse_tz.c#L777
and also from this new POSIX string format through https://github.com/derickr/timelib/blob/master/parse_posix.c
â What is no longer available is a list with ever single utc-offset change, which is what
powered this getTransitions function.
------------------------------------------------------------------------
[2021-04-17 15:54:07] thekid@php.net
When given min and max timestamps, we simply get the passed-in timestamp back in UTC
# PHP 8.1-dev
php-r '$tz= new DateTimeZone("America/Los_Angeles"); $t=
$tz->getTransitions(time(), time() + 31536000); var_dump($t);' | grep 'string(24)'
string(24) "2021-04-17T15:50:22+0000"
# PHP 8.0.3
php-r '$tz= new DateTimeZone("America/Los_Angeles"); $t=
$tz->getTransitions(time(), time() + 31536000); var_dump($t);' | grep 'string(24)'
string(24) "2021-04-17T15:52:43+0000"
string(24) "2021-11-07T09:00:00+0000"
string(24) "2022-03-13T10:00:00+0000"
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80963
--
Edit this bug report at https://bugs.php.net/bug.php?id=80963&edit=1