1--TEST--
2create() icu >= 53.1 && icu < 54.1
3--EXTENSIONS--
4intl
5--SKIPIF--
6<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
7<?php if (version_compare(INTL_ICU_VERSION, '54.1') >=  0) die('skip for ICU < 54.1'); ?>
8--FILE--
9<?php
10
11/*
12 * Try creating collator with different locales
13 * with Procedural and Object methods.
14 */
15
16function ut_main()
17{
18    $res_str = '';
19
20    $locales = array(
21        'EN-US-ODESSA',
22        'UK_UA_ODESSA',
23        'uk-ua_CALIFORNIA@currency=;currency=GRN',
24        '',
25        'root',
26        'uk@currency=EURO',
27    '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
28    );
29
30    foreach( $locales as $locale )
31    {
32        // Create Collator with the current locale.
33        $coll = ut_coll_create( $locale );
34        if( !is_object($coll) )
35        {
36            $res_str .= "Error creating collator with '$locale' locale: " .
37                 intl_get_error_message() . "\n";
38            continue;
39        }
40
41        // Get the requested, valid and actual locales.
42        $vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
43        $aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
44
45        // Show them.
46        $res_str .= "Locale: '$locale'\n" .
47            "  ULOC_REQUESTED_LOCALE = '$locale'\n" .
48            "  ULOC_VALID_LOCALE     = '$vloc'\n" .
49            "  ULOC_ACTUAL_LOCALE    = '$aloc'\n";
50    }
51
52    return $res_str;
53}
54
55include_once( 'ut_common.inc' );
56ut_run();
57
58?>
59--EXPECTF--
60Locale: 'EN-US-ODESSA'
61  ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
62  ULOC_VALID_LOCALE     = 'en_US'
63  ULOC_ACTUAL_LOCALE    = 'root'
64Locale: 'UK_UA_ODESSA'
65  ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
66  ULOC_VALID_LOCALE     = 'uk'
67  ULOC_ACTUAL_LOCALE    = 'uk'
68Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
69  ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
70  ULOC_VALID_LOCALE     = 'root'
71  ULOC_ACTUAL_LOCALE    = 'root'
72Locale: ''
73  ULOC_REQUESTED_LOCALE = ''
74  ULOC_VALID_LOCALE     = '%s'
75  ULOC_ACTUAL_LOCALE    = '%s'
76Locale: 'root'
77  ULOC_REQUESTED_LOCALE = 'root'
78  ULOC_VALID_LOCALE     = 'root'
79  ULOC_ACTUAL_LOCALE    = 'root'
80Locale: 'uk@currency=EURO'
81  ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
82  ULOC_VALID_LOCALE     = 'uk'
83  ULOC_ACTUAL_LOCALE    = 'uk'
84Error creating collator with '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than %d characters: U_ILLEGAL_ARGUMENT_ERROR
85