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