From 4840b0a749454335218f6131892031333d66142d Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 7 Oct 2013 13:49:10 +0200 Subject: fixed failing tests for ICU >= 51.2 --- ext/intl/tests/bug58756_MessageFormatter.phpt | 5 ++++- ext/intl/tests/collator_asort.phpt | 1 + ext/intl/tests/collator_compare.phpt | 1 + ext/intl/tests/collator_get_sort_key.phpt | 4 +++- ext/intl/tests/collator_sort.phpt | 1 + ext/intl/tests/collator_sort_with_sort_keys.phpt | 1 + ext/intl/tests/dateformat_calendars.phpt | 4 ++-- ext/intl/tests/dateformat_create_cal_arg.phpt | 4 ++-- ext/intl/tests/dateformat_format.phpt | 1 + ext/intl/tests/dateformat_formatObject_calendar.phpt | 4 ++-- ext/intl/tests/dateformat_formatObject_datetime.phpt | 4 ++-- ext/intl/tests/dateformat_format_parse.phpt | 1 + ext/intl/tests/dateformat_get_set_calendar.phpt | 4 ++-- ext/intl/tests/dateformat_get_set_timezone.phpt | 4 ++-- ext/intl/tests/dateformat_set_timezone_id2.phpt | 1 + ext/intl/tests/dateformat_timezone_arg_variations.phpt | 4 ++-- ext/intl/tests/formatter_get_locale.phpt | 1 + ext/intl/tests/locale_filter_matches2.phpt | 3 ++- ext/intl/tests/locale_get_display_name2.phpt | 3 ++- ext/intl/tests/locale_get_display_region2.phpt | 3 ++- ext/intl/tests/locale_lookup.phpt | 1 + ext/intl/tests/msgfmt_format_intlcalendar.phpt | 6 +++--- ext/intl/tests/resourcebundle_null_mandatory_args.phpt | 8 +++----- ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt | 12 +++++------- 24 files changed, 47 insertions(+), 34 deletions(-) (limited to 'ext/intl') diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt index bbe96b7045..18566b666c 100644 --- a/ext/intl/tests/bug58756_MessageFormatter.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter.phpt @@ -4,6 +4,9 @@ Bug #58756: w.r.t MessageFormatter = 0) + die('skip for ICU < 51.2'); +?> --FILE-- format(array($time, 'date')), " ", --EXPECT-- date: Tuesday, July 7, 2009 8:41:13 PM EDT msgf: Tuesday, July 7, 2009 8:41:13 PM EDT -==DONE== \ No newline at end of file +==DONE== diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt index a614ddc3f8..308f3a3ca3 100644 --- a/ext/intl/tests/collator_asort.phpt +++ b/ext/intl/tests/collator_asort.phpt @@ -2,6 +2,7 @@ asort() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 4.8 only'; ?> += 4.8 and < 51.2 */ +if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 4.8 +locale_filter_matches.phpt() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 4.8 +locale_get_display_name() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 4.8 +locale_get_display_region() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- format(array($time, 'date')), " ", ==DONE== --EXPECT-- Quinta-feira, 17 de Maio de 2012 5:35:36 p.m. WEST -==DONE== \ No newline at end of file +==DONE== diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt index 17fab6d630..bbbc1b1e91 100644 --- a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt +++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt @@ -3,11 +3,9 @@ ResourceBundle constructor bundle accepts NULL for first two arguments --INI-- date.timezone=Atlantic/Azores --SKIPIF-- -= 4.8 only'); + += 4.8 only'); ?> += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 49) +IntlTimeZone::getDisplayName(): type parameter (ICU >= 49 && ICU < 51.2) --SKIPIF-- - + += 0) die('skip for ICU < 51.2'); ?> --FILE-- Date: Mon, 7 Oct 2013 13:49:55 +0200 Subject: added fixed tests for ICU >= 51.2 --- .../tests/bug58756_MessageFormatter_variant2.phpt | 37 ++ ext/intl/tests/collator_asort_variant2.phpt | 243 ++++++++++++ ext/intl/tests/collator_compare_variant2.phpt | 135 +++++++ ext/intl/tests/collator_get_sort_key_variant2.phpt | 98 +++++ ext/intl/tests/collator_sort_variant2.phpt | 248 ++++++++++++ .../collator_sort_with_sort_keys_variant2.phpt | 190 +++++++++ ext/intl/tests/dateformat_calendars_variant2.phpt | 45 +++ .../tests/dateformat_create_cal_arg_variant2.phpt | 53 +++ .../dateformat_formatObject_calendar_variant2.phpt | 40 ++ .../dateformat_formatObject_datetime_variant2.phpt | 33 ++ .../tests/dateformat_format_parse_version2.phpt | 295 ++++++++++++++ ext/intl/tests/dateformat_format_variant2.phpt | 423 +++++++++++++++++++++ .../dateformat_get_set_calendar_variant2.phpt | 55 +++ .../dateformat_get_set_timezone_variant2.phpt | 62 +++ ext/intl/tests/dateformat_set_timezone_id3.phpt | 85 +++++ .../tests/dateformat_timezone_arg_variations2.phpt | 45 +++ ext/intl/tests/formatter_get_locale_variant2.phpt | 50 +++ ext/intl/tests/locale_filter_matches3.phpt | 366 ++++++++++++++++++ ext/intl/tests/locale_get_display_name3.phpt | 342 +++++++++++++++++ ext/intl/tests/locale_get_display_region3.phpt | 275 ++++++++++++++ ext/intl/tests/locale_lookup_variant2.phpt | 100 +++++ .../tests/msgfmt_format_intlcalendar_variant2.phpt | 30 ++ ...esourcebundle_null_mandatory_args_variant2.phpt | 26 ++ .../tests/timezone_getDisplayName_variant4.phpt | 35 ++ 24 files changed, 3311 insertions(+) create mode 100644 ext/intl/tests/bug58756_MessageFormatter_variant2.phpt create mode 100644 ext/intl/tests/collator_asort_variant2.phpt create mode 100644 ext/intl/tests/collator_compare_variant2.phpt create mode 100644 ext/intl/tests/collator_get_sort_key_variant2.phpt create mode 100644 ext/intl/tests/collator_sort_variant2.phpt create mode 100644 ext/intl/tests/collator_sort_with_sort_keys_variant2.phpt create mode 100644 ext/intl/tests/dateformat_calendars_variant2.phpt create mode 100644 ext/intl/tests/dateformat_create_cal_arg_variant2.phpt create mode 100644 ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt create mode 100644 ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt create mode 100644 ext/intl/tests/dateformat_format_parse_version2.phpt create mode 100644 ext/intl/tests/dateformat_format_variant2.phpt create mode 100644 ext/intl/tests/dateformat_get_set_calendar_variant2.phpt create mode 100644 ext/intl/tests/dateformat_get_set_timezone_variant2.phpt create mode 100644 ext/intl/tests/dateformat_set_timezone_id3.phpt create mode 100644 ext/intl/tests/dateformat_timezone_arg_variations2.phpt create mode 100644 ext/intl/tests/formatter_get_locale_variant2.phpt create mode 100644 ext/intl/tests/locale_filter_matches3.phpt create mode 100644 ext/intl/tests/locale_get_display_name3.phpt create mode 100644 ext/intl/tests/locale_get_display_region3.phpt create mode 100644 ext/intl/tests/locale_lookup_variant2.phpt create mode 100644 ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt create mode 100644 ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt create mode 100644 ext/intl/tests/timezone_getDisplayName_variant4.phpt (limited to 'ext/intl') diff --git a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt new file mode 100644 index 0000000000..4fcfdbc08c --- /dev/null +++ b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #58756: w.r.t MessageFormatter +--SKIPIF-- += 51.2'); +?> +--FILE-- +format(array($time)) . "\n"; + +//NOT FIXED: +/*$msgf = new MessageFormatter('en_US', +'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); + +echo "msgf2: ", $msgf->format(array($time, 'date')), " ", + $msgf->format(array($time, 'time')), "\n"; +*/ + +?> +==DONE== +--EXPECT-- +date: Tuesday, July 7, 2009 8:41:13 PM EDT +msgf: Tuesday, July 7, 2009 8:41:13 PM usnyc +==DONE== diff --git a/ext/intl/tests/collator_asort_variant2.phpt b/ext/intl/tests/collator_asort_variant2.phpt new file mode 100644 index 0000000000..f9dff13608 --- /dev/null +++ b/ext/intl/tests/collator_asort_variant2.phpt @@ -0,0 +1,243 @@ +--TEST-- +asort() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + 'y' , + 'c' => 'i' , + 'a' => 'k' ), + + array( 'a' => 'a' , + 'b' => 'aaa', + 'c' => 'aa' ), + + array( 'a' => 'a' , + 'aaa'=> 'a' , + 'aa' => 'a' ), + + array( '1' => 'abc', + '5' => '!' , + '2' => null , + '7' => '' ), + + array( '1' => '100', + '2' => '25' , + '3' => '36' ), + + array( '1' => 5 , + '2' => '30' , + '3' => 2 ) + ); + + $res_str .= sort_arrays( 'en_US', $test_params ); + + // Sort an array in SORT_STRING mode using en_US locale. + $test_params = array( + array( '1' => '100', + '2' => '25' , + '3' => '36' ), + + array( '1' => 5 , + '2' => '30' , + '3' => 2 ), + + array( '1' => 'd' , + '2' => '' , + '3' => ' a' ), + + array( '1' => 'y' , + '2' => 'k' , + '3' => 'i' ) + ); + + $res_str .= sort_arrays( 'en_US', $test_params, Collator::SORT_STRING ); + + // Sort a non-ASCII array using ru_RU locale. + $test_params = array( + array( 'п' => 'у', + 'б' => 'в', + 'е' => 'а' ), + + array( '1' => 'п', + '4' => '', + '7' => 'd', + '2' => 'пп' ) + ); + + $res_str .= sort_arrays( 'ru_RU', $test_params ); + + + // Sort an array using Lithuanian locale. + $test_params = array( + array( 'd' => 'y', + 'c' => 'i', + 'a' => 'k' ) + ); + + $res_str .= sort_arrays( 'lt_LT', $test_params ); + + return $res_str . "\n"; +} + +include_once( 'ut_common.inc' ); +ut_run(); +?> +--EXPECT-- +Test 1.162b81ac12878b817fc39063097e45b5: +array ( + 'c' => 'i', + 'a' => 'k', + 'd' => 'y', +) + Result: true + +Test 2.93d96e22f692d8a281b0a389f01f8d1e: +array ( + 'a' => 'a', + 'c' => 'aa', + 'b' => 'aaa', +) + Result: true + +Test 3.9f25de4482bc7b58de508e278113317c: +array ( + 'aa' => 'a', + 'aaa' => 'a', + 'a' => 'a', +) + Result: true + +Test 4.a85a41ea78e45b651080cfd98c0b431d: +array ( + 7 => '', + 2 => NULL, + 5 => '!', + 1 => 'abc', +) + Result: true + +Test 5.99dc71f405b286e03d489061b36e6900: +array ( + 2 => '25', + 3 => '36', + 1 => '100', +) + Result: true + +Test 6.bf5bba243307c9d12934e756ad4be190: +array ( + 3 => 2, + 1 => 5, + 2 => '30', +) + Result: true + +Test 7.e4ee7024c61476e9e7a6c28b5e47df6f: +array ( + 1 => '100', + 2 => '25', + 3 => '36', +) + Result: true + +Test 8.5fa7033dd43784be0db1474eb48b83c8: +array ( + 3 => 2, + 2 => '30', + 1 => 5, +) + Result: true + +Test 9.588cdf4692bc09aa92ffe7e48f9e4579: +array ( + 2 => '', + 3 => ' a', + 1 => 'd', +) + Result: true + +Test 10.be02641a47ebcccd23e4183ca3a415f7: +array ( + 3 => 'i', + 2 => 'k', + 1 => 'y', +) + Result: true + +Test 11.153d9b11d1e5936afc917a94a4e11f34: +array ( + 'е' => 'а', + 'б' => 'в', + 'п' => 'у', +) + Result: true + +Test 12.e1f5cb037b564dce39ffbd0a61562d59: +array ( + 4 => '', + 1 => 'п', + 2 => 'пп', + 7 => 'd', +) + Result: true + +Test 13.8800d48abb960a59002eef77f1d73ae0: +array ( + 'c' => 'i', + 'd' => 'y', + 'a' => 'k', +) + Result: true diff --git a/ext/intl/tests/collator_compare_variant2.phpt b/ext/intl/tests/collator_compare_variant2.phpt new file mode 100644 index 0000000000..15c725bc4f --- /dev/null +++ b/ext/intl/tests/collator_compare_variant2.phpt @@ -0,0 +1,135 @@ +--TEST-- +compare() +--SKIPIF-- + += 51.2'); ?> +--FILE-- +'; + case -1: // UCOL_LESS + return '<'; + default: + return '?'; + } +} + +/* + * Compare string pairs in the given array + * using specified locale. + */ +function compare_pairs( $locale, $test_array ) +{ + $res_str = ''; + + $coll = ut_coll_create( $locale ); + + foreach( $test_array as $test_strings ) + { + list( $str1, $str2 ) = $test_strings; + + // Compare strings. + $res_val = cmp_to_char( ut_coll_compare( $coll, $str1, $str2 ) ); + + // Concatenate result strings. + $res_str .= dump( $str1 ) . + ' ' . $res_val . ' ' . + dump( $str2 ) . "\n"; + } + + return $res_str; + +} + +function ut_main() +{ + $res_str = ''; + + // Compare strings using en_US locale. + $test_params = array( + array( 'abc', 'abc' ), + array( 'Abc', 'abc' ), + array( 'a' , 'abc' ), + array( 'a' , '' ), + array( '' , '' ), + array( 'a' , 'b' ), + array( 'ab' , 'b' ), + array( 'ab' , 'a' ), + array( 123 , 'abc' ), + array( 'ac' , null ), + array( '.' , '.' ), + // Try to compare long strings. + array( 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde', + 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'), + array( null , null ) + ); + + $res_str .= compare_pairs( 'en_US', $test_params ); + + + // Compare strings using ru_RU locale. + $test_params = array( + array( 'а', 'б' ), + array( 'а', 'аа' ), + array( 'аб', 'ба' ), + array( 'а', ',' ), + array( 'а', 'b' ), + array( 'а', 'bb' ), + array( 'а', 'ab' ), + array( 'а', null ) + ); + + $res_str .= compare_pairs( 'ru_RU', $test_params ); + + + // Compare strings using lt_LT locale. + $test_params = array( + array( 'y', 'k' ) + ); + + $res_str .= compare_pairs( 'lt_LT', $test_params ); + + return $res_str; +} + +include_once( 'ut_common.inc' ); +ut_run(); +?> +--EXPECT-- +'abc' = 'abc' +'Abc' > 'abc' +'a' < 'abc' +'a' > '' +'' = '' +'a' < 'b' +'ab' < 'b' +'ab' > 'a' +123 < 'abc' +'ac' > NULL +'.' = '.' +'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde' < 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea' +NULL = NULL +'а' < 'б' +'а' < 'аа' +'аб' < 'ба' +'а' > ',' +'а' < 'b' +'а' < 'bb' +'а' < 'ab' +'а' > NULL +'y' < 'k' diff --git a/ext/intl/tests/collator_get_sort_key_variant2.phpt b/ext/intl/tests/collator_get_sort_key_variant2.phpt new file mode 100644 index 0000000000..bb09256d6b --- /dev/null +++ b/ext/intl/tests/collator_get_sort_key_variant2.phpt @@ -0,0 +1,98 @@ +--TEST-- +collator_get_sort_key() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +source: abc +key: 27292b01070107 +source: abd +key: 27292d01070107 +source: aaa +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 +source: z +key: 5901050105 +source: +key: 0101 +source: +key: 0101 +source: 3 +key: 1801050105 +source: y +key: 5701050105 +source: i +key: 3701050105 +source: k +key: 3b01050105 +source: абг +key: 260a161a01070107 +source: абв +key: 260a161801070107 +source: жжж +key: 263a3a3a01070107 +source: эюя +key: 273b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107 diff --git a/ext/intl/tests/collator_sort_variant2.phpt b/ext/intl/tests/collator_sort_variant2.phpt new file mode 100644 index 0000000000..29a5082fda --- /dev/null +++ b/ext/intl/tests/collator_sort_variant2.phpt @@ -0,0 +1,248 @@ +--TEST-- +sort() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +Test 1.e8f1cd28133d79ecd660002f1c660d0e: +array ( + 0 => 'aaa', + 1 => 'abc', + 2 => 'abd', +) + Result: true + +Test 2.c2ded12173dd2996927378cae37eb275: +array ( + 0 => '_', + 1 => '1', + 2 => 'm', +) + Result: true + +Test 3.54071c968d71cb98c5d379145f8d7d38: +array ( + 0 => 'a', + 1 => 'aa', + 2 => 'aaa', +) + Result: true + +Test 4.19abe63d6f6dfef65b0e3c9ab4826b07: +array ( + 0 => 'ab', + 1 => 'b', + 2 => 'ba', +) + Result: true + +Test 5.9a8dc0a9bc771368c2f1fc3d02754610: +array ( + 0 => 'a', + 1 => 'c', + 2 => 'e', +) + Result: true + +Test 6.ab530b060e5e54a65bfb8b9f8fc61870: +array ( + 0 => '25', + 1 => '36', + 2 => '100', +) + Result: true + +Test 7.0718dd838509017bded2ed307a6e785f: +array ( + 0 => 2, + 1 => 5, + 2 => '30', +) + Result: true + +Test 8.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 9.289bc2f28e87d3201ec9d7e8477ae1b0: +array ( + 0 => ' a', + 1 => 'd ', + 2 => 'f ', +) + Result: true + +Test 10.de0fd958484f2377a645835d7fbcf124: +array ( + 0 => NULL, + 1 => '3', + 2 => 'a', +) + Result: true + +Test 11.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 12.1e6b4d6f7df9d4580317634ea46d8208: +array ( + 0 => '100', + 1 => '25', + 2 => '36', +) + Result: true + +Test 13.cec115dc9850b98dfbdf102efa09e61b: +array ( + 0 => 2, + 1 => '30', + 2 => 5, +) + Result: true + +Test 14.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 15.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 16.49056308afb2b800363c5baa735ed247: +array ( + 0 => 'ааа', + 1 => 'абв', + 2 => 'абг', + 3 => 'abc', +) + Result: true + +Test 17.91480b10473a0c96a4cd6d88c23c577a: +array ( + 0 => 'а', + 1 => 'аа', + 2 => 'ааа', +) + Result: true + +Test 18.fdd3fe3981476039164aa000bf9177f2: +array ( + 0 => 'i', + 1 => 'y', + 2 => 'k', +) + Result: true diff --git a/ext/intl/tests/collator_sort_with_sort_keys_variant2.phpt b/ext/intl/tests/collator_sort_with_sort_keys_variant2.phpt new file mode 100644 index 0000000000..5257f8a6ff --- /dev/null +++ b/ext/intl/tests/collator_sort_with_sort_keys_variant2.phpt @@ -0,0 +1,190 @@ +--TEST-- +sort_with_sort_keys() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +Test 1.e8f1cd28133d79ecd660002f1c660d0e: +array ( + 0 => 'aaa', + 1 => 'abc', + 2 => 'abd', +) + Result: true + +Test 2.c2ded12173dd2996927378cae37eb275: +array ( + 0 => '_', + 1 => '1', + 2 => 'm', +) + Result: true + +Test 3.54071c968d71cb98c5d379145f8d7d38: +array ( + 0 => 'a', + 1 => 'aa', + 2 => 'aaa', +) + Result: true + +Test 4.19abe63d6f6dfef65b0e3c9ab4826b07: +array ( + 0 => 'ab', + 1 => 'b', + 2 => 'ba', +) + Result: true + +Test 5.9a8dc0a9bc771368c2f1fc3d02754610: +array ( + 0 => 'a', + 1 => 'c', + 2 => 'e', +) + Result: true + +Test 6.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 7.289bc2f28e87d3201ec9d7e8477ae1b0: +array ( + 0 => ' a', + 1 => 'd ', + 2 => 'f ', +) + Result: true + +Test 8.de0fd958484f2377a645835d7fbcf124: +array ( + 0 => NULL, + 1 => '3', + 2 => 'a', +) + Result: true + +Test 9.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 10.49056308afb2b800363c5baa735ed247: +array ( + 0 => 'ааа', + 1 => 'абв', + 2 => 'абг', + 3 => 'abc', +) + Result: true + +Test 11.91480b10473a0c96a4cd6d88c23c577a: +array ( + 0 => 'а', + 1 => 'аа', + 2 => 'ааа', +) + Result: true + +Test 12.fdd3fe3981476039164aa000bf9177f2: +array ( + 0 => 'i', + 1 => 'y', + 2 => 'k', +) + Result: true diff --git a/ext/intl/tests/dateformat_calendars_variant2.phpt b/ext/intl/tests/dateformat_calendars_variant2.phpt new file mode 100644 index 0000000000..61cdea8408 --- /dev/null +++ b/ext/intl/tests/dateformat_calendars_variant2.phpt @@ -0,0 +1,45 @@ +--TEST-- +IntlDateFormatter, calendars and time zone +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); + +new IntlDateFormatter('en_US@calendar=hebrew', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); +?> +==DONE== +--EXPECTF-- +string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12" +string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12" +string(48) "Sunday, Tevet 6, 5772 AM at 5:12:00 AM GMT+05:12" + +Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php on line %d +==DONE== diff --git a/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt b/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt new file mode 100644 index 0000000000..70b862017b --- /dev/null +++ b/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt @@ -0,0 +1,53 @@ +--TEST-- +IntlDateFormatter: several forms of the calendar arg +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format($ts), "\n"; + +$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic'); +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal); +echo $df->format($ts), "\n"; + +//override calendar's timezone +$cal = new IntlGregorianCalendar('UTC', NULL); +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal); +echo $df->format($ts), "\n"; + +//default calendar is gregorian +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0); +echo $df->format($ts), "\n"; + +//try now with traditional +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +//the timezone can be overridden when not specifying a calendar +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0); +echo $df->format($ts), "\n"; + +?> +==DONE== +--EXPECTF-- +domingo%S 1 de enero de 2012 00:00:00 GMT +domingo%S 8 de Safar de 1433 00:00:00 GMT +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa central +sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores +sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores +domingo%S 8 de Safar de 1433 AH 00:00:00 GMT +domingo%S 1 de enero de 2012 00:00:00 GMT +==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt new file mode 100644 index 0000000000..1ec1fa669a --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlDateFormatter::formatObject(): IntlCalendar tests +--SKIPIF-- + += 51.2'); ?> +--FILE-- +setTime(strtotime('2012-01-01 00:00:00')*1000.); +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00 +06/02/1433, 00:00:00 +Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time +==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt new file mode 100644 index 0000000000..2ca9ffd7e8 --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00 +==DONE== diff --git a/ext/intl/tests/dateformat_format_parse_version2.phpt b/ext/intl/tests/dateformat_format_parse_version2.phpt new file mode 100644 index 0000000000..8c6f00ef54 --- /dev/null +++ b/ext/intl/tests/dateformat_format_parse_version2.phpt @@ -0,0 +1,295 @@ +--TEST-- +datefmt_format_code() and datefmt_parse_code() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( + 'tm_sec' => 11, + 'tm_min' => 13, + 'tm_hour' => 0, + 'tm_mday' => 17, + 'tm_mon' => 11, + 'tm_year' => -5 + ); + + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ + $res_str .= "$key : '$value' , "; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } +/* + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } +*/ + } + } + } + + return $res_str; + +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +------------ + +Input timestamp is : 0 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 5:00:00 AM GMT+05:00 +Parsed timestamp is : 0 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 5:00:00 AM GMT+5 +Parsed timestamp is : 0 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 5:00:00 AM +Parsed timestamp is : 0 +------------ + +Input timestamp is : -1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, December 18, 1969 at 7:40:00 AM GMT+05:00 +Parsed timestamp is : -1200000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 18, 1969 at 7:40:00 AM GMT+5 +Parsed timestamp is : -1200000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 18, 1969, 7:40:00 AM +Parsed timestamp is : -1200000 +------------ + +Input timestamp is : 1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 15, 1970 at 2:20:00 AM GMT+05:00 +Parsed timestamp is : 1200000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 15, 1970 at 2:20:00 AM GMT+5 +Parsed timestamp is : 1200000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 15, 1970, 2:20:00 AM +Parsed timestamp is : 1200000 +------------ + +Input timestamp is : 2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Monday, September 19, 2039 at 4:06:40 AM GMT+05:00 +Parsed timestamp is : 2200000000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : September 19, 2039 at 4:06:40 AM GMT+5 +Parsed timestamp is : 2200000000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Sep 19, 2039, 4:06:40 AM +Parsed timestamp is : 2200000000 +------------ + +Input timestamp is : -2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Sunday, April 15, 1900 at 5:53:20 AM GMT+05:00 +Parsed timestamp is : -2200000000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : April 15, 1900 at 5:53:20 AM GMT+5 +Parsed timestamp is : -2200000000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Apr 15, 1900, 5:53:20 AM +Parsed timestamp is : -2200000000 +------------ + +Input timestamp is : 90099999 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, November 9, 1972 at 12:46:39 AM GMT+05:00 +Parsed timestamp is : 90099999 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 9, 1972 at 12:46:39 AM GMT+5 +Parsed timestamp is : 90099999 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 9, 1972, 12:46:39 AM +Parsed timestamp is : 90099999 +------------ + +Input timestamp is : 3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 6:00:00 AM GMT+05:00 +Parsed timestamp is : 3600 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 6:00:00 AM GMT+5 +Parsed timestamp is : 3600 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 6:00:00 AM +Parsed timestamp is : 3600 +------------ + +Input timestamp is : -3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 4:00:00 AM GMT+05:00 +Parsed timestamp is : -3600 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 4:00:00 AM GMT+5 +Parsed timestamp is : -3600 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 4:00:00 AM +Parsed timestamp is : -3600 +------------ + +Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT+05:00 +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT+5 +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +------------ + +Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '7' , tm_year : '205' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Thursday, August 13, 2105 at 7:05:21 AM GMT+05:00 +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : August 13, 2105 at 7:05:21 AM GMT+5 +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Aug 13, 2105, 7:05:21 AM +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +------------ + +Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT+05:00 +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT+5 +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt new file mode 100644 index 0000000000..7c5bcfcfd4 --- /dev/null +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -0,0 +1,423 @@ +--TEST-- +datefmt_format_code() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( + 'tm_sec' => 11, + 'tm_min' => 13, + 'tm_hour' => 0, + 'tm_mday' => 17, + 'tm_mon' => 11, + 'tm_year' => -5 + ); + + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ + $res_str .= "$key : '$value' , "; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; + +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +------------ + +Input timestamp is : 0 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 2:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 2:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 2:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 2:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 02:00 PM +------------ + +Input timestamp is : -1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 17, 1969 at 4:40:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 17, 1969 at 4:40:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 17, 1969, 4:40:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/17/69, 4:40 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691217 04:40 PM +------------ + +Input timestamp is : 1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, January 14, 1970 at 11:20:00 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 14, 1970 at 11:20:00 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 14, 1970, 11:20:00 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 1/14/70, 11:20 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19700114 11:20 AM +------------ + +Input timestamp is : 2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Sunday, September 18, 2039 at 1:06:40 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : September 18, 2039 at 1:06:40 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Sep 18, 2039, 1:06:40 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 9/18/39, 1:06 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 20390918 01:06 PM +------------ + +Input timestamp is : -2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Saturday, April 14, 1900 at 2:53:20 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : April 14, 1900 at 2:53:20 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Apr 14, 1900, 2:53:20 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 4/14/00, 2:53 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19000414 02:53 PM +------------ + +Input timestamp is : 90099999 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, November 8, 1972 at 9:46:39 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 8, 1972 at 9:46:39 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 8, 1972, 9:46:39 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 11/8/72, 9:46 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19721108 09:46 AM +------------ + +Input timestamp is : 3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 3:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 3:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 3:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 3:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 03:00 PM +------------ + +Input timestamp is : -3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 1:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 1:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 1:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 1:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 01:00 PM +------------ + +Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 4/3/05, 7:03 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 20050403 07:03 PM +------------ + +Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '4' , tm_year : '205' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Wednesday, May 13, 2105 at 7:05:21 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : May 13, 2105 at 7:05:21 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : May 13, 2105, 7:05:21 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 5/13/05, 7:05 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 21050513 07:05 AM +------------ + +Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 12/17/95, 12:13 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 18951217 12:13 AM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : Thursday, December 31, 2009 at 3:02:03 PM GMT-10:00 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : December 31, 2009 at 3:02:03 PM GMT-10 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : Dec 31, 2009, 3:02:03 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : 12/31/09, 3:02 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : 20091231 03:02 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : Saturday, December 30, 2000 at 5:04:05 PM GMT-10:00 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : December 30, 2000 at 5:04:05 PM GMT-10 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : Dec 30, 2000, 5:04:05 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : 12/30/00, 5:04 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : 20001230 05:04 PM +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt new file mode 100644 index 0000000000..1c5169e65d --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt @@ -0,0 +1,55 @@ +--TEST-- +IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format($ts), "\n"; +var_dump($df->getCalendar(), +$df->getCalendarObject()->getType(), +$df->getCalendarObject()->getTimeZone()->getId()); +echo "\n"; +} + +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); + + +//changing the calendar with a cal type should not change tz +$df->setCalendar(IntlDateFormatter::TRADITIONAL); +d($df); + +//but changing with an actual calendar should +$cal = IntlCalendar::createInstance("UTC"); +$df->setCalendar($cal); +d($df); + +?> +==DONE== +--EXPECT-- +dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00 +int(1) +string(9) "gregorian" +string(12) "Europe/Minsk" + +dimanche 8 safar 1433 AH 03:00:00 UTC+03:00 +int(0) +string(7) "islamic" +string(12) "Europe/Minsk" + +dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC +bool(false) +string(9) "gregorian" +string(3) "UTC" + +==DONE== diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt new file mode 100644 index 0000000000..af9ddf29a4 --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt @@ -0,0 +1,62 @@ +--TEST-- +IntlDateFormatter: get/setTimeZone() +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format($ts), "\n"; +var_dump( +$df->getTimeZoneID(), +$df->getTimeZone()->getID()); +echo "\n"; +} + +$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk'); +d($df); + +$df->setTimeZone(NULL); +d($df); + +$df->setTimeZone('Europe/Madrid'); +d($df); + +$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris')); +d($df); + +$df->setTimeZone(new DateTimeZone('Europe/Amsterdam')); +d($df); + +?> +==DONE== +--EXPECTF-- +Domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00 +string(12) "Europe/Minsk" +string(12) "Europe/Minsk" + +Sábado, 31 de Dezembro de 2011 às 23:00:00 Hor%s %Sdos Açores +string(15) "Atlantic/Azores" +string(15) "Atlantic/Azores" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(13) "Europe/Madrid" +string(13) "Europe/Madrid" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(12) "Europe/Paris" +string(12) "Europe/Paris" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(16) "Europe/Amsterdam" +string(16) "Europe/Amsterdam" + +==DONE== diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt new file mode 100644 index 0000000000..b3968f9ac0 --- /dev/null +++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt @@ -0,0 +1,85 @@ +--TEST-- +datefmt_set_timezone_id_code() icu >= 4.8 +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTF-- +Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d + +Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d + +After creation of the dateformatter : timezone_id= US/Pacific +----------- +Trying to set timezone_id= America/New_York +After call to set_timezone_id : timezone_id= America/New_York +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Eastern Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 8:00:00 PM Eastern Standard Time +----------- +Trying to set timezone_id= America/Los_Angeles +After call to set_timezone_id : timezone_id= America/Los_Angeles +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 5:00:00 PM Pacific Standard Time +----------- +Trying to set timezone_id= America/Chicago +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time +----------- +Trying to set timezone_id= CN +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time diff --git a/ext/intl/tests/dateformat_timezone_arg_variations2.phpt b/ext/intl/tests/dateformat_timezone_arg_variations2.phpt new file mode 100644 index 0000000000..a957963a44 --- /dev/null +++ b/ext/intl/tests/dateformat_timezone_arg_variations2.phpt @@ -0,0 +1,45 @@ +--TEST-- +IntlDateFormatter: several forms of the timezone arg +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam'); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, IntlTimeZone::createTimeZone('America/New_York')); +echo $df->format($ts), "\n"; + +//time zone has priority +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +//calendar has priority +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0); +echo $df->format($ts), "\n"; + +--EXPECTF-- +sábado%S, 31 de diciembre de 2011 23:00:00 Hora estándar de las Azores +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central +domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental +sábado%S, 31 de diciembre de 2011 19:00:00 Hora estándar oriental +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central +domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central diff --git a/ext/intl/tests/formatter_get_locale_variant2.phpt b/ext/intl/tests/formatter_get_locale_variant2.phpt new file mode 100644 index 0000000000..9d25d1cf90 --- /dev/null +++ b/ext/intl/tests/formatter_get_locale_variant2.phpt @@ -0,0 +1,50 @@ +--TEST-- +numfmt_get_locale() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + 'actual', + Locale::VALID_LOCALE => 'valid', + ); + + $res_str = ''; + + foreach( $locales as $locale ) + { + $fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL ); + $res_str .= "$locale: "; + foreach( $loc_types as $loc_type => $loc_type_name ) + $res_str .= sprintf( " %s=%s", + $loc_type_name, + dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) ); + $res_str .= "\n"; + } + + return $res_str; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +en_UK: actual='en' valid='en' +en_US@California: actual='en' valid='en' +fr_CA: actual='fr' valid='fr_CA' diff --git a/ext/intl/tests/locale_filter_matches3.phpt b/ext/intl/tests/locale_filter_matches3.phpt new file mode 100644 index 0000000000..4c1d4d3898 --- /dev/null +++ b/ext/intl/tests/locale_filter_matches3.phpt @@ -0,0 +1,366 @@ +--TEST-- +locale_filter_matches.phpt() ICU >= 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +-------------- +loc_range:de-de matches lang_tag de-DEVA ? NO +loc_range:de_DE canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:de-de matches lang_tag de-DE-1996 ? YES +loc_range:de_DE canonically matches lang_tag de_DE_1996 ? YES +-------------- +loc_range:de-de matches lang_tag de-DE ? YES +loc_range:de_DE canonically matches lang_tag de_DE ? YES +-------------- +loc_range:de-de matches lang_tag zh_Hans ? NO +loc_range:de_DE canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:de-de matches lang_tag de-CH-1996 ? NO +loc_range:de_DE canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT ? NO +loc_range:de_DE canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_rozaj ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:de-de matches lang_tag i-enochian ? NO +loc_range:de_DE canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:de-de matches lang_tag sgn-CH-de ? NO +loc_range:de_DE canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:de-de matches lang_tag art-lojban ? NO +loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:de-de matches lang_tag i-lux ? NO +loc_range:de_DE canonically matches lang_tag lb ? NO +-------------- +loc_range:de-de matches lang_tag art-lojban ? NO +loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:de-de matches lang_tag jbo ? NO +loc_range:de_DE canonically matches lang_tag jbo ? NO +-------------- +loc_range:de-de matches lang_tag en_sl_IT ? NO +loc_range:de_DE canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DEVA ? NO +loc_range:sl_IT canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE ? NO +loc_range:sl_IT canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag zh_Hans ? NO +loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag sl_IT ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT matches lang_tag i-enochian ? NO +loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag i-lux ? NO +loc_range:sl_IT canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag jbo ? NO +loc_range:sl_IT canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT matches lang_tag en_sl_IT ? NO +loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DEVA ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DE ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag zh_Hans ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_rozaj ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT_Nedis matches lang_tag i-enochian ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag i-lux ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag jbo ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag en_sl_IT ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:jbo matches lang_tag de-DEVA ? NO +loc_range:jbo canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:jbo matches lang_tag de-DE-1996 ? NO +loc_range:jbo canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:jbo matches lang_tag de-DE ? NO +loc_range:jbo canonically matches lang_tag de_DE ? NO +-------------- +loc_range:jbo matches lang_tag zh_Hans ? NO +loc_range:jbo canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:jbo matches lang_tag de-CH-1996 ? NO +loc_range:jbo canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT ? NO +loc_range:jbo canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_rozaj ? NO +loc_range:jbo canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:jbo matches lang_tag i-enochian ? NO +loc_range:jbo canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:jbo matches lang_tag sgn-CH-de ? NO +loc_range:jbo canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:jbo matches lang_tag art-lojban ? NO +loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:jbo matches lang_tag i-lux ? NO +loc_range:jbo canonically matches lang_tag lb ? NO +-------------- +loc_range:jbo matches lang_tag art-lojban ? NO +loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:jbo matches lang_tag jbo ? YES +loc_range:jbo canonically matches lang_tag jbo ? YES +-------------- +loc_range:jbo matches lang_tag en_sl_IT ? NO +loc_range:jbo canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DEVA ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DE-1996 ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DE ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_DE ? NO +-------------- +loc_range:art-lojban matches lang_tag zh_Hans ? NO +loc_range:art__LOJBAN canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:art-lojban matches lang_tag de-CH-1996 ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_rozaj ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:art-lojban matches lang_tag i-enochian ? NO +loc_range:art__LOJBAN canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:art-lojban matches lang_tag sgn-CH-de ? NO +loc_range:art__LOJBAN canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:art-lojban matches lang_tag art-lojban ? YES +loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES +-------------- +loc_range:art-lojban matches lang_tag i-lux ? NO +loc_range:art__LOJBAN canonically matches lang_tag lb ? NO +-------------- +loc_range:art-lojban matches lang_tag art-lojban ? YES +loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES +-------------- +loc_range:art-lojban matches lang_tag jbo ? NO +loc_range:art__LOJBAN canonically matches lang_tag jbo ? NO +-------------- +loc_range:art-lojban matches lang_tag en_sl_IT ? NO +loc_range:art__LOJBAN canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DEVA ? NO +loc_range:sl_IT canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE ? NO +loc_range:sl_IT canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag zh_Hans ? NO +loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag sl_IT ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT matches lang_tag i-enochian ? NO +loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag i-lux ? NO +loc_range:sl_IT canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag jbo ? NO +loc_range:sl_IT canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT matches lang_tag en_sl_IT ? NO +loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO diff --git a/ext/intl/tests/locale_get_display_name3.phpt b/ext/intl/tests/locale_get_display_name3.phpt new file mode 100644 index 0000000000..3f3d26fcfa --- /dev/null +++ b/ext/intl/tests/locale_get_display_name3.phpt @@ -0,0 +1,342 @@ +--TEST-- +locale_get_display_name() icu >= 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTREGEX-- +locale='sl_IT_nedis_KIRTI' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI# +disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI# +----------------- +locale='sl_IT_nedis-a-kirti-x-xyz' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ# +disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ# +----------------- +locale='sl_IT_rozaj' +disp_locale=en : display_name=Slovenian #Italy, Resian# +disp_locale=fr : display_name=slovène #Italie, dialecte de Resia# +disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)# +----------------- +locale='sl_IT_NEDIS_ROJAZ_1901' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901# +disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901# +----------------- +locale='i-enochian' +disp_locale=en : display_name=i-enochian #Private-Use=i-enochian# +disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian# +disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian# +----------------- +locale='zh-hakka' +disp_locale=en : display_name=Chinese( #HAKKA#)? +disp_locale=fr : display_name=chinois( #HAKKA#)? +disp_locale=de : display_name=Chinesisch( #HAKKA#)? +----------------- +locale='zh-wuu' +disp_locale=en : display_name=Chinese #WUU# +disp_locale=fr : display_name=chinois #WUU# +disp_locale=de : display_name=Chinesisch #WUU# +----------------- +locale='i-tay' +disp_locale=en : display_name=i-tay +disp_locale=fr : display_name=i-tay +disp_locale=de : display_name=i-tay +----------------- +locale='sgn-BE-nl' +disp_locale=en : display_name=Sign Languages? #Belgium, NL# +disp_locale=fr : display_name=langues? des signes #Belgique, NL# +disp_locale=de : display_name=Gebärdensprache #Belgien, NL# +----------------- +locale='sgn-CH-de' +disp_locale=en : display_name=Sign Languages? #Switzerland, DE# +disp_locale=fr : display_name=langues? des signes #Suisse, DE# +disp_locale=de : display_name=Gebärdensprache #Schweiz, DE# +----------------- +locale='sl_IT_rozaj@currency=EUR' +disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro# +disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro# +disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# +----------------- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_name=Ukrainian #Ukraine, CALIFORNIA, [Cc]urrency# +disp_locale=fr : display_name=ukrainien #Ukraine, CALIFORNIA, [Dd]evise# +disp_locale=de : display_name=Ukrainisch #Ukraine, CALIFORNIA, Währung# +----------------- +locale='root' +disp_locale=en : display_name=Root +disp_locale=fr : display_name=racine +disp_locale=de : display_name=[Rr]oot +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO# +disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO# +disp_locale=de : display_name=Ukrainisch #Währung=EURO# +----------------- +locale='Hindi' +disp_locale=en : display_name=hindi +disp_locale=fr : display_name=hindi +disp_locale=de : display_name=hindi +----------------- +locale='de' +disp_locale=en : display_name=German +disp_locale=fr : display_name=allemand +disp_locale=de : display_name=Deutsch +----------------- +locale='fr' +disp_locale=en : display_name=French +disp_locale=fr : display_name=français +disp_locale=de : display_name=Französisch +----------------- +locale='ja' +disp_locale=en : display_name=Japanese +disp_locale=fr : display_name=japonais +disp_locale=de : display_name=Japanisch +----------------- +locale='i-enochian' +disp_locale=en : display_name=i-enochian #Private-Use=i-enochian# +disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian# +disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian# +----------------- +locale='zh-Hant' +disp_locale=en : display_name=Chinese #Traditional# +disp_locale=fr : display_name=chinois #traditionnel# +disp_locale=de : display_name=Chinesisch #Traditionell# +----------------- +locale='zh-Hans' +disp_locale=en : display_name=Chinese #Simplified# +disp_locale=fr : display_name=chinois #simplifié# +disp_locale=de : display_name=Chinesisch #Vereinfacht# +----------------- +locale='sr-Cyrl' +disp_locale=en : display_name=Serbian #Cyrillic# +disp_locale=fr : display_name=serbe #cyrillique# +disp_locale=de : display_name=Serbisch #Kyrillisch# +----------------- +locale='sr-Latn' +disp_locale=en : display_name=Serbian #Latin# +disp_locale=fr : display_name=serbe #latin# +disp_locale=de : display_name=Serbisch #Lateinisch# +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_name=Chinese #Simplified, China# +disp_locale=fr : display_name=chinois #simplifié, Chine# +disp_locale=de : display_name=Chinesisch #Vereinfacht, China# +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_name=Serbian #Latin, Serbia# +disp_locale=fr : display_name=serbe #latin, Serbie# +disp_locale=de : display_name=Serbisch #Lateinisch, Serbien# +----------------- +locale='sl-rozaj' +disp_locale=en : display_name=Slovenian #Resian# +disp_locale=fr : display_name=slovène #dialecte de Resia# +disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)? +----------------- +locale='sl-nedis' +disp_locale=en : display_name=Slovenian #Natisone dialect# +disp_locale=fr : display_name=slovène #dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Natisone-Dialekt# +----------------- +locale='de-CH-1901' +disp_locale=en : display_name=German #Switzerland, Traditional German orthography# +disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle# +disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)# +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_name=Slovenian #Italy, Natisone dialect# +disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)# +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect# +disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)# +----------------- +locale='de-DE' +disp_locale=en : display_name=German #Germany# +disp_locale=fr : display_name=allemand #Allemagne# +disp_locale=de : display_name=Deutsch #Deutschland# +----------------- +locale='en-US' +disp_locale=en : display_name=English #United States# +disp_locale=fr : display_name=anglais #États-Unis# +disp_locale=de : display_name=Englisch #Vereinigte Staaten# +----------------- +locale='es-419' +disp_locale=en : display_name=Spanish #Latin America# +disp_locale=fr : display_name=espagnol #Amérique latine# +disp_locale=de : display_name=Spanisch #Lateinamerika# +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk# +disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk# +disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk# +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend# +disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend# +disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend# +----------------- +locale='zh-min' +disp_locale=en : display_name=Chinese #MIN# +disp_locale=fr : display_name=chinois #MIN# +disp_locale=de : display_name=Chinesisch #MIN# +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN# +disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN# +disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN# +----------------- +locale='x-whatever' +disp_locale=en : display_name=x-whatever #Private-Use=whatever# +disp_locale=fr : display_name=x-whatever #Usage privé=whatever# +disp_locale=de : display_name=x-whatever #Privatnutzung=whatever# +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern# +disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern# +disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern# +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_name=Serbian #Latin, QM# +disp_locale=fr : display_name=serbe #latin, QM# +disp_locale=de : display_name=Serbisch #Lateinisch, QM# +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_name=Serbian #Qaaa, Serbia# +disp_locale=fr : display_name=serbe #Qaaa, Serbie# +disp_locale=de : display_name=Serbisch #Qaaa, Serbien# +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_name=English #United States, attribute=islamcal# +disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal# +disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal# +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private# +disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private# +disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private# +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_name=English #a=myext, b=another# +disp_locale=fr : display_name=anglais #a=myext, b=another# +disp_locale=de : display_name=Englisch #a=myext, b=another# +----------------- +locale='de-419-DE' +disp_locale=en : display_name=German #Latin America, DE# +disp_locale=fr : display_name=allemand #Amérique latine, DE# +disp_locale=de : display_name=Deutsch #Lateinamerika, DE# +----------------- +locale='a-DE' +disp_locale=en : display_name=a #Germany# +disp_locale=fr : display_name=a #Allemagne# +disp_locale=de : display_name=a #Deutschland# +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_name=Arabic #a=aaa, b=bbb# +disp_locale=fr : display_name=arabe #a=aaa, b=bbb# +disp_locale=de : display_name=Arabisch #a=aaa, b=bbb# +----------------- diff --git a/ext/intl/tests/locale_get_display_region3.phpt b/ext/intl/tests/locale_get_display_region3.phpt new file mode 100644 index 0000000000..ec287a6446 --- /dev/null +++ b/ext/intl/tests/locale_get_display_region3.phpt @@ -0,0 +1,275 @@ +--TEST-- +locale_get_display_region() icu >= 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTREGEX-- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_region=Ukraine +disp_locale=fr : display_region=Ukraine +disp_locale=de : display_region=Ukraine +----------------- +locale='root' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='Hindi' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='de' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='fr' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='ja' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='i-enochian' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hant' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hans' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='sr-Cyrl' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='sr-Latn' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_region=China +disp_locale=fr : display_region=Chine +disp_locale=de : display_region=China +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_region=Serbia +disp_locale=fr : display_region=Serbie +disp_locale=de : display_region=Serbien +----------------- +locale='sl-rozaj' +disp_locale=en : display_region=(ROZAJ)? +disp_locale=fr : display_region=(ROZAJ)? +disp_locale=de : display_region=(ROZAJ)? +----------------- +locale='sl-nedis' +disp_locale=en : display_region=(NEDIS)? +disp_locale=fr : display_region=(NEDIS)? +disp_locale=de : display_region=(NEDIS)? +----------------- +locale='de-CH-1901' +disp_locale=en : display_region=Switzerland +disp_locale=fr : display_region=Suisse +disp_locale=de : display_region=Schweiz +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_region=Italy +disp_locale=fr : display_region=Italie +disp_locale=de : display_region=Italien +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_region=Italy +disp_locale=fr : display_region=Italie +disp_locale=de : display_region=Italien +----------------- +locale='de-DE' +disp_locale=en : display_region=Germany +disp_locale=fr : display_region=Allemagne +disp_locale=de : display_region=Deutschland +----------------- +locale='en-US' +disp_locale=en : display_region=United States +disp_locale=fr : display_region=États-Unis +disp_locale=de : display_region=Vereinigte Staaten +----------------- +locale='es-419' +disp_locale=en : display_region=Latin America +disp_locale=fr : display_region=Amérique latine +disp_locale=de : display_region=Lateinamerika +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_region=Switzerland +disp_locale=fr : display_region=Suisse +disp_locale=de : display_region=Schweiz +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_region=X? +disp_locale=fr : display_region=X? +disp_locale=de : display_region=X? +----------------- +locale='zh-min' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_region=MIN +disp_locale=fr : display_region=MIN +disp_locale=de : display_region=MIN +----------------- +locale='x-whatever' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_region=QM +disp_locale=fr : display_region=QM +disp_locale=de : display_region=QM +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_region=QM +disp_locale=fr : display_region=QM +disp_locale=de : display_region=QM +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_region=Serbia +disp_locale=fr : display_region=Serbie +disp_locale=de : display_region=Serbien +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_region=United States +disp_locale=fr : display_region=États-Unis +disp_locale=de : display_region=Vereinigte Staaten +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_region=China +disp_locale=fr : display_region=Chine +disp_locale=de : display_region=China +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_region=A? +disp_locale=fr : display_region=A? +disp_locale=de : display_region=A? +----------------- +locale='de-419-DE' +disp_locale=en : display_region=Latin America +disp_locale=fr : display_region=Amérique latine +disp_locale=de : display_region=Lateinamerika +----------------- +locale='a-DE' +disp_locale=en : display_region=Germany +disp_locale=fr : display_region=Allemagne +disp_locale=de : display_region=Deutschland +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_region=A? +disp_locale=fr : display_region=A? +disp_locale=de : display_region=A? +----------------- diff --git a/ext/intl/tests/locale_lookup_variant2.phpt b/ext/intl/tests/locale_lookup_variant2.phpt new file mode 100644 index 0000000000..4715951e9a --- /dev/null +++ b/ext/intl/tests/locale_lookup_variant2.phpt @@ -0,0 +1,100 @@ +--TEST-- +locale_lookup.phpt() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +-------------- +loc_range:de-de +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:de-DE +Canonical lookup result:de_de +-------------- +loc_range:sl_IT +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:sl_IT +Canonical lookup result:sl_it +-------------- +loc_range:sl_IT_Nedis +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:sl_IT +Canonical lookup result:sl_it +-------------- +loc_range:jbo +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:jbo +Canonical lookup result:jbo +-------------- +loc_range:art-lojban +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:art-lojban +Canonical lookup result:art__lojban diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt new file mode 100644 index 0000000000..f2d16b899d --- /dev/null +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt @@ -0,0 +1,30 @@ +--TEST-- +MessageFormat accepts IntlCalendar args +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format(array($cal)), "\n"; + +//NOT FIXED: +/*$msgf = new MessageFormatter('en_US', +'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); + +echo "msgf2: ", $msgf->format(array($time, 'date')), " ", + $msgf->format(array($time, 'time')), "\n"; +*/ + +?> +==DONE== +--EXPECT-- +Quinta-feira, 17 de Maio de 2012 5:35:36 PM ptlis +==DONE== diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt new file mode 100644 index 0000000000..cf721c8ef2 --- /dev/null +++ b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt @@ -0,0 +1,26 @@ +--TEST-- +ResourceBundle constructor bundle accepts NULL for first two arguments +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- + += 51.2'); ?> +--FILE-- +get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); + +ini_set('intl.default_locale', 'pt_PT'); +$r = new ResourceBundle(NULL, NULL); +$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); +?> +==DONE== +--EXPECT-- +string(14) "h:mm:ss a zzzz" +string(13) "HH:mm:ss zzzz" +==DONE== diff --git a/ext/intl/tests/timezone_getDisplayName_variant4.phpt b/ext/intl/tests/timezone_getDisplayName_variant4.phpt new file mode 100644 index 0000000000..39e28892a4 --- /dev/null +++ b/ext/intl/tests/timezone_getDisplayName_variant4.phpt @@ -0,0 +1,35 @@ +--TEST-- +IntlTimeZone::getDisplayName(): type parameter (ICU >= 51.2) +--SKIPIF-- + += 51.2'); ?> +--FILE-- +getDisplayName(false, IntlTimeZone::DISPLAY_SHORT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GENERIC)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GENERIC)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GMT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GMT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_COMMONLY_USED)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_GENERIC_LOCATION)); + +?> +==DONE== +--EXPECT-- +string(3) "GMT" +string(30) "Western European Standard Time" +string(13) "Portugal Time" +string(21) "Western European Time" +string(5) "+0000" +string(3) "GMT" +string(3) "GMT" +string(13) "Portugal Time" +==DONE== -- cgit v1.2.1 From 646813a37a061763656829ab6470231aa6f38d33 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 20 Oct 2013 21:57:33 -0700 Subject: fix possibility of access to *storedType without initialization --- ext/intl/msgformat/msgformat_helpers.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/intl') diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index c4456d54f3..f75fd91dce 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -209,6 +209,9 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, continue; } } + } else { + intl_errors_set(&err, U_INVALID_FORMAT_ERROR, "Invalid part type encountered", 0 TSRMLS_CC); + continue; } UMessagePatternArgType argType = p.getArgType(); -- cgit v1.2.1 From dab1d76e9def81acd51d2ea9ed55c74af1a093ed Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 20 Oct 2013 22:04:21 -0700 Subject: Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag --- ext/intl/locale/locale_methods.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/intl') diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 1707c69f93..9c5b09a7bc 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -127,6 +127,9 @@ static char* getPreferredTag(char* gf_tag) int grOffset = 0; grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag); + if(grOffset < 0) { + return NULL; + } if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){ /* return preferred tag */ result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] ); -- cgit v1.2.1 From ef9069b4ef71ecf1b514e7f8544f0d470e00dca5 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 20 Oct 2013 22:32:20 -0700 Subject: fix const warnings in intl methods --- ext/intl/collator/collator_create.c | 2 +- ext/intl/formatter/formatter_main.c | 2 +- ext/intl/locale/locale_methods.c | 46 +++++++++++++++++------------------ ext/intl/msgformat/msgformat.c | 2 +- ext/intl/msgformat/msgformat_format.c | 2 +- ext/intl/msgformat/msgformat_parse.c | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'ext/intl') diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index b2a8c7f6ba..7ed4c53439 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -27,7 +27,7 @@ /* {{{ */ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; int locale_len = 0; zval* object; Collator_object* co; diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index d0671a88b5..0a568472c4 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -27,7 +27,7 @@ /* {{{ */ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; char* pattern = NULL; int locale_len = 0, pattern_len = 0; long style; diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 915f4d5af4..21b5847f2d 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -121,7 +121,7 @@ static int16_t findOffset(const char* const* list, const char* key) } /*}}}*/ -static char* getPreferredTag(char* gf_tag) +static char* getPreferredTag(const char* gf_tag) { char* result = NULL; int grOffset = 0; @@ -175,7 +175,7 @@ static int getStrrtokenPos(char* str, int savedPos) * returns -1 if no singleton * strtok equivalent search for singleton */ -static int getSingletonPos(char* str) +static int getSingletonPos(const char* str) { int result =-1; int i=0; @@ -251,7 +251,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) * common code shared by get_primary_language,get_script or get_region or get_variant * result = 0 if error, 1 if successful , -1 if no value */ -static char* get_icu_value_internal( char* loc_name , char* tag_name, int* result , int fromParseLocale) +static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* result , int fromParseLocale) { char* tag_value = NULL; int32_t tag_value_len = 512; @@ -281,7 +281,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul /* Handle singletons */ if( strcmp(tag_name , LOC_LANG_TAG)==0 ){ if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){ - return loc_name; + return (char *)loc_name; } } @@ -370,7 +370,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; char* tag_value = NULL; @@ -465,10 +465,10 @@ PHP_FUNCTION(locale_get_primary_language ) }}} */ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; - char* disp_loc_name = NULL; + const char* disp_loc_name = NULL; int disp_loc_name_len = 0; int free_loc_name = 0; @@ -561,7 +561,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME efree( mod_loc_name ); } if (free_loc_name) { - efree(disp_loc_name); + efree((void *)disp_loc_name); disp_loc_name = NULL; } RETURN_FALSE; @@ -572,7 +572,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME efree( mod_loc_name ); } if (free_loc_name) { - efree(disp_loc_name); + efree((void *)disp_loc_name); disp_loc_name = NULL; } /* Convert display locale name from UTF-16 to UTF-8. */ @@ -666,10 +666,10 @@ PHP_FUNCTION( locale_get_keywords ) UEnumeration* e = NULL; UErrorCode status = U_ZERO_ERROR; - const char* kw_key = NULL; + const char* kw_key = NULL; int32_t kw_key_len = 0; - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; /* @@ -716,7 +716,7 @@ PHP_FUNCTION( locale_get_keywords ) kw_value = erealloc( kw_value , kw_value_len+1); } if (U_FAILURE(status)) { - intl_error_set( NULL, FAILURE, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC ); + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC ); if( kw_value){ efree( kw_value ); } @@ -974,12 +974,12 @@ PHP_FUNCTION(locale_compose) * e.g. for locale='en_US-x-prv1-prv2-prv3' * returns a pointer to the string 'prv1-prv2-prv3' */ -static char* get_private_subtags(char* loc_name) +static char* get_private_subtags(const char* loc_name) { char* result =NULL; int singletonPos = 0; int len =0; - char* mod_loc_name =NULL; + const char* mod_loc_name =NULL; if( loc_name && (len = strlen(loc_name)>0 ) ){ mod_loc_name = loc_name ; @@ -1019,7 +1019,7 @@ static char* get_private_subtags(char* loc_name) /* {{{ code used by locale_parse */ -static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC) +static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC) { char* key_value = NULL; char* cur_key_name = NULL; @@ -1084,7 +1084,7 @@ static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS */ PHP_FUNCTION(locale_parse) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; int grOffset = 0; @@ -1128,8 +1128,8 @@ PHP_FUNCTION(locale_parse) */ PHP_FUNCTION(locale_get_all_variants) { - char* loc_name = NULL; - int loc_name_len = 0; + const char* loc_name = NULL; + int loc_name_len = 0; int result = 0; char* token = NULL; @@ -1182,10 +1182,10 @@ PHP_FUNCTION(locale_get_all_variants) /*{{{ * Converts to lower case and also replaces all hyphens with the underscore */ -static int strToMatch(char* str ,char *retstr) +static int strToMatch(const char* str ,char *retstr) { char* anchor = NULL; - char* anchor1 = NULL; + const char* anchor1 = NULL; int result = 0; int len = 0; @@ -1225,7 +1225,7 @@ PHP_FUNCTION(locale_filter_matches) { char* lang_tag = NULL; int lang_tag_len = 0; - char* loc_range = NULL; + const char* loc_range = NULL; int loc_range_len = 0; int result = 0; @@ -1401,7 +1401,7 @@ static void array_cleanup( char* arr[] , int arr_size) * returns the lookup result to lookup_loc_range_src_php * internal function */ -static char* lookup_loc_range(char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC) +static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC) { int i = 0; int cur_arr_len = 0; @@ -1523,7 +1523,7 @@ PHP_FUNCTION(locale_lookup) { char* fallback_loc = NULL; int fallback_loc_len = 0; - char* loc_range = NULL; + const char* loc_range = NULL; int loc_range_len = 0; zval* arr = NULL; diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 6a9f04f32b..7d8cd958e3 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -28,7 +28,7 @@ /* {{{ */ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; char* pattern; int locale_len = 0, pattern_len = 0; UChar* spattern = NULL; diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 4b81cfe2b4..55ec9e84ba 100644 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -103,7 +103,7 @@ PHP_FUNCTION( msgfmt_format_message ) int spattern_len = 0; char *pattern = NULL; int pattern_len = 0; - char *slocale = NULL; + const char *slocale = NULL; int slocale_len = 0; MessageFormatter_object mf = {0}; MessageFormatter_object *mfo = &mf; diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 413d3b1f15..14a6363424 100644 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -93,7 +93,7 @@ PHP_FUNCTION( msgfmt_parse_message ) int spattern_len = 0; char *pattern = NULL; int pattern_len = 0; - char *slocale = NULL; + const char *slocale = NULL; int slocale_len = 0; char *source = NULL; int src_len = 0; -- cgit v1.2.1 From 8bef8e66cfaa575b63b5032b2cce32c5f73b3c94 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 20 Oct 2013 22:59:07 -0700 Subject: fix argument type & remove warning --- ext/intl/dateformat/dateformat_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/intl') diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index 4193e89017..9930778546 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -62,7 +62,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex } /* }}} */ -static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, UCalendar parsed_calendar, long calendar_field, char* key_name TSRMLS_DC) +static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC) { long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" ); @@ -83,7 +83,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va */ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value TSRMLS_DC) { - UCalendar* parsed_calendar = NULL; + UCalendar *parsed_calendar = NULL; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; long isInDST = 0; @@ -92,7 +92,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" ); - parsed_calendar = udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); + parsed_calendar = (UCalendar *)udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar, text_utf16, text_utf16_len, parse_pos, &INTL_DATA_ERROR_CODE(dfo)); if (text_utf16) { -- cgit v1.2.1