Skip to content

Commit 2654c34

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: 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 56a8b5f + a6d14f1 commit 2654c34

7 files changed

+438
-4
lines changed

ext/intl/breakiterator/codepointiterator_internal.cpp

+4
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

+4
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ PHP_FUNCTION(locale_filter_matches)
12381238
if( token && (token==cur_lang_tag) ){
12391239
/* check if the char. after match is SEPARATOR */
12401240
chrcheck = token + (strlen(cur_loc_range));
1241-
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
1241+
if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
12421242
efree( cur_lang_tag );
12431243
efree( cur_loc_range );
12441244
if( can_lang_tag){

ext/intl/tests/dateformat_get_set_calendar_variant5.phpt

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

ext/intl/tests/locale_filter_matches4.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ locale_filter_matches.phpt() ICU >= 67.1
33
--EXTENSIONS--
44
intl
55
--SKIPIF--
6-
<?php if (version_compare(INTL_ICU_VERSION, '67.1') < 0) die('skip for ICU >= 67.1'); ?>
6+
<?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'); ?>
77
--FILE--
88
<?php
99

0 commit comments

Comments
 (0)