Skip to content

Commit

Permalink
Update tests for ICU 64
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed May 31, 2019
1 parent 4ef7f70 commit 8a8bc5c
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ext/intl/locale/locale_methods.c
Expand Up @@ -1538,7 +1538,7 @@ PHP_FUNCTION(locale_lookup)

intl_error_reset( NULL );

if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS", &arr, &loc_range, &loc_range_len,
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS!", &arr, &loc_range, &loc_range_len,

This comment has been minimized.

Copy link
@weltling

weltling May 31, 2019

Contributor

Thanks for getting hands on this, Nikita. We were just getting to the ICU upgrades, too. A question in this regard - this patch should likely land in 7.2. Regarding that, the ZPP change for sure doesn't belong in 7.2/7.3. Is there something specific preventing leave it as is in 7.2?

Thanks.

This comment has been minimized.

Copy link
@nikic

nikic May 31, 2019

Author Member

The zpp change is ok to land on 7.2, the current signature does not handle null parameters correctly (they should be treated the same as not passed and use the default locale). This kinda worked with ICU < 64 because using the empty string ended up falling back in the same way, apparently.

This comment has been minimized.

Copy link
@weltling

weltling May 31, 2019

Contributor

Ok, thanks for the explanation. For 7.2 and 7.3 perhaps it would be safer to make this conditional, say any lower 64 should still use same buggy code. Getting to these backports next days.

Thanks.

&boolCanonical, &fallback_loc_str) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 );
RETURN_FALSE;
Expand Down
1 change: 1 addition & 0 deletions ext/intl/tests/breakiter_getLocale_basic2.phpt
Expand Up @@ -3,6 +3,7 @@ IntlBreakIterator::getLocale(): basic test
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
Expand Down
20 changes: 20 additions & 0 deletions ext/intl/tests/breakiter_getLocale_basic3.phpt
@@ -0,0 +1,20 @@
--TEST--
IntlBreakIterator::getLocale(): basic test
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createSentenceInstance('pt');

var_dump($bi->getLocale(0));
var_dump($bi->getLocale(1));
?>
==DONE==
--EXPECT--
string(0) ""
string(2) "pt"
==DONE==
6 changes: 3 additions & 3 deletions ext/intl/tests/locale_get_display_language.phpt
Expand Up @@ -99,9 +99,9 @@ disp_locale=fr : display_language=ukrainien
disp_locale=de : display_language=Ukrainisch
-----------------
locale='root'
disp_locale=en : display_language=Root
disp_locale=fr : display_language=racine
disp_locale=de : display_language=[rR]oot
disp_locale=en : display_language=(Root|Unknown language)
disp_locale=fr : display_language=(racine|langue indéterminée)
disp_locale=de : display_language=([rR]oot|Unbekannte Sprache)
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_language=Ukrainian
Expand Down
1 change: 1 addition & 0 deletions ext/intl/tests/locale_get_display_name5.phpt
Expand Up @@ -3,6 +3,7 @@ locale_get_display_name() icu >= 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
--FILE--
<?php

Expand Down

0 comments on commit 8a8bc5c

Please sign in to comment.