mirror of
https://github.com/php/php-src.git
synced 2026-04-14 19:41:05 +02:00
Fixed bug #81504: Incorrect timezone transition details for POSIX data
This commit is contained in:
4
NEWS
4
NEWS
@@ -10,6 +10,10 @@ PHP NEWS
|
||||
Doleček)
|
||||
. Fixed bug #81380 (Observer may not be initialized properly). (krakjoe)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #81504 (Incorrect timezone transition details for POSIX data).
|
||||
(Derick)
|
||||
|
||||
- PCRE:
|
||||
. Unfixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb)
|
||||
|
||||
|
||||
@@ -3620,6 +3620,15 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \
|
||||
add_next_index_zval(return_value, &element);
|
||||
|
||||
#define add_by_index(i,ts) \
|
||||
array_init(&element); \
|
||||
add_assoc_long(&element, "ts", ts); \
|
||||
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0)); \
|
||||
add_assoc_long(&element, "offset", tzobj->tzi.tz->type[i].offset); \
|
||||
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[i].isdst); \
|
||||
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[i].abbr_idx]); \
|
||||
add_next_index_zval(return_value, &element);
|
||||
|
||||
#define add_last() add(tzobj->tzi.tz->bit64.timecnt - 1, timestamp_begin)
|
||||
|
||||
array_init(return_value);
|
||||
@@ -3685,7 +3694,7 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
if (transitions.times[j] > timestamp_end) {
|
||||
return;
|
||||
}
|
||||
add(transitions.types[j], transitions.times[j]);
|
||||
add_by_index(transitions.types[j], transitions.times[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
ext/date/tests/bug81504.phpt
Normal file
16
ext/date/tests/bug81504.phpt
Normal file
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #81504: Incorrect timezone transition details for POSIX data
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$tz = new DateTimeZone('Europe/Amsterdam');
|
||||
foreach ($tz->getTransitions(strtotime("1996-01-01"), strtotime("1997-12-31")) as $tr) {
|
||||
echo "{$tr['time']} {$tr['offset']} {$tr['abbr']}\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
1996-01-01T00:00:00+0000 3600 CET
|
||||
1996-03-31T01:00:00+0000 7200 CEST
|
||||
1996-10-27T01:00:00+0000 3600 CET
|
||||
1997-03-30T01:00:00+0000 7200 CEST
|
||||
1997-10-26T01:00:00+0000 3600 CET
|
||||
Reference in New Issue
Block a user