Skip to content

Commit a6d14f1

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: CLDR 40a0 uses a lowercase "temp" instead of "Temp" in ICU >= 70.1 Accommodate changes to canonicalized forms in ICU >= 70.1 Change UBool to bool for equality operators in ICU >= 70.1
2 parents 2605911 + c7a2441 commit a6d14f1

7 files changed

+437
-6
lines changed

ext/intl/breakiterator/codepointiterator_internal.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ CodePointBreakIterator::~CodePointBreakIterator()
7373
clearCurrentCharIter();
7474
}
7575

76+
#if U_ICU_VERSION_MAJOR_NUM >= 70
77+
bool CodePointBreakIterator::operator==(const BreakIterator& that) const
78+
#else
7679
UBool CodePointBreakIterator::operator==(const BreakIterator& that) const
80+
#endif
7781
{
7882
if (typeid(*this) != typeid(that)) {
7983
return false;

ext/intl/breakiterator/codepointiterator_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ namespace PHP {
3737

3838
virtual ~CodePointBreakIterator();
3939

40+
#if U_ICU_VERSION_MAJOR_NUM >= 70
41+
virtual bool operator==(const BreakIterator& that) const;
42+
#else
4043
virtual UBool operator==(const BreakIterator& that) const;
44+
#endif
4145

4246
virtual CodePointBreakIterator* clone(void) const;
4347

ext/intl/locale/locale_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ PHP_FUNCTION(locale_filter_matches)
12391239
if( token && (token==cur_lang_tag) ){
12401240
/* check if the char. after match is SEPARATOR */
12411241
chrcheck = token + (strlen(cur_loc_range));
1242-
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
1242+
if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
12431243
efree( cur_lang_tag );
12441244
efree( cur_loc_range );
12451245
if( can_lang_tag){

ext/intl/tests/dateformat_get_set_calendar_variant5.phpt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
--TEST--
2-
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
2+
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 58.1 and < 70.1
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
6-
<?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.1'); ?>
5+
if (!extension_loaded('intl')) die('skip intl extension not enabled');
6+
if (version_compare(INTL_ICU_VERSION, '58.1') < 0 || version_compare(INTL_ICU_VERSION, '70.1') >= 0) die('skip for ICU >= 58.1 and < 70.1');
7+
?>
78
--FILE--
89
<?php
910
ini_set("intl.error_level", E_WARNING);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 70.1
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('intl')) die('skip');
6+
if (version_compare(INTL_ICU_VERSION, '70.1') < 0) die('skip for ICU >= 70.1');
7+
?>
8+
--FILE--
9+
<?php
10+
ini_set("intl.error_level", E_WARNING);
11+
ini_set("intl.default_locale", "pt_PT");
12+
ini_set("date.timezone", 'Atlantic/Azores');
13+
14+
$ts = strtotime('2012-01-01 00:00:00 UTC');
15+
16+
function d(IntlDateFormatter $df) {
17+
global $ts;
18+
echo $df->format($ts), "\n";
19+
var_dump($df->getCalendar(),
20+
$df->getCalendarObject()->getType(),
21+
$df->getCalendarObject()->getTimeZone()->getId());
22+
echo "\n";
23+
}
24+
25+
$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
26+
d($df);
27+
28+
29+
//changing the calendar with a cal type should not change tz
30+
$df->setCalendar(IntlDateFormatter::TRADITIONAL);
31+
d($df);
32+
33+
//but changing with an actual calendar should
34+
$cal = IntlCalendar::createInstance("UTC");
35+
$df->setCalendar($cal);
36+
d($df);
37+
38+
?>
39+
--EXPECT--
40+
dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad
41+
int(1)
42+
string(9) "gregorian"
43+
string(12) "Europe/Minsk"
44+
45+
dimanche 8 safar 1433 AH à 03:00:00 heure de Kaliningrad
46+
int(0)
47+
string(7) "islamic"
48+
string(12) "Europe/Minsk"
49+
50+
dimanche 1 janvier 2012 ap. J.-C. à 00:00:00 temps universel coordonné
51+
bool(false)
52+
string(9) "gregorian"
53+
string(3) "UTC"
54+

ext/intl/tests/locale_filter_matches4.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
--TEST--
2-
locale_filter_matches.phpt() ICU >= 67.1
2+
locale_filter_matches.phpt() for ICU >= 67.1 and < 70.1
33
--SKIPIF--
44
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5-
<?php if (version_compare(INTL_ICU_VERSION, '67.1') < 0) die('skip for ICU >= 67.1'); ?>
5+
<?php if (version_compare(INTL_ICU_VERSION, '67.1') < 0 || version_compare(INTL_ICU_VERSION, '70.1') >= 0) die('skip for ICU >= 67.1 and < 70.1'); ?>
66
--FILE--
77
<?php
88

0 commit comments

Comments
 (0)