Skip to content

Commit 2205546

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Change ZPP only if compiled with ICU >= 64 Update tests for ICU 64
2 parents 06eef1f + ee153de commit 2205546

8 files changed

+377
-7
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,11 +1538,17 @@ PHP_FUNCTION(locale_lookup)
15381538

15391539
intl_error_reset( NULL );
15401540

1541-
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS", &arr, &loc_range, &loc_range_len,
1541+
#if U_ICU_VERSION_MAJOR_NUM > 63
1542+
# define BANG "!"
1543+
#else
1544+
# define BANG
1545+
#endif
1546+
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS" BANG, &arr, &loc_range, &loc_range_len,
15421547
&boolCanonical, &fallback_loc_str) == FAILURE) {
15431548
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 );
15441549
RETURN_FALSE;
15451550
}
1551+
#undef BANG
15461552

15471553
if(loc_range_len == 0) {
15481554
if(fallback_loc_str) {

ext/intl/tests/breakiter_getLocale_basic2.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ IntlBreakIterator::getLocale(): basic test
33
--SKIPIF--
44
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
55
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
6+
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
67
--FILE--
78
<?php
89
ini_set("intl.error_level", E_WARNING);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
IntlBreakIterator::getLocale(): basic test
3+
--SKIPIF--
4+
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
5+
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
6+
--FILE--
7+
<?php
8+
ini_set("intl.error_level", E_WARNING);
9+
ini_set("intl.default_locale", "pt_PT");
10+
11+
$bi = IntlBreakIterator::createSentenceInstance('pt');
12+
13+
var_dump($bi->getLocale(0));
14+
var_dump($bi->getLocale(1));
15+
?>
16+
==DONE==
17+
--EXPECT--
18+
string(0) ""
19+
string(2) "pt"
20+
==DONE==

ext/intl/tests/locale_get_display_language.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ disp_locale=fr : display_language=ukrainien
9999
disp_locale=de : display_language=Ukrainisch
100100
-----------------
101101
locale='root'
102-
disp_locale=en : display_language=Root
103-
disp_locale=fr : display_language=racine
104-
disp_locale=de : display_language=[rR]oot
102+
disp_locale=en : display_language=(Root|Unknown language)
103+
disp_locale=fr : display_language=(racine|langue indéterminée)
104+
disp_locale=de : display_language=([rR]oot|Unbekannte Sprache)
105105
-----------------
106106
locale='uk@currency=EURO'
107107
disp_locale=en : display_language=Ukrainian

ext/intl/tests/locale_get_display_name5.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ locale_get_display_name() icu >= 53.1
33
--SKIPIF--
44
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
55
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
6+
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
67
--FILE--
78
<?php
89

0 commit comments

Comments
 (0)