1--TEST--
2get_locale() icu >= 4.8
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
6<?php if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
7--FILE--
8<?php
9
10/*
11 * Try to specify valid and invalid locale types when getting locale.
12 */
13
14function ut_main()
15{
16    $locales = array(
17        Locale::VALID_LOCALE,
18        Locale::ACTUAL_LOCALE,
19        100,
20        -100,
21        -9999999999999,
22        9999999999999,
23        1.2,
24    );
25
26    $coll = ut_coll_create( 'en_US' );
27    $res_str = '';
28
29    foreach( $locales as $locale )
30    {
31        $rc = ut_coll_get_locale( $coll, $locale );
32
33        $res_str .= sprintf(
34            "Locale of type %s is %s\n",
35            dump( $locale ),
36            dump( $rc ) );
37    }
38
39    return $res_str . "\n";
40}
41
42include_once( 'ut_common.inc' );
43ut_run();
44?>
45--EXPECT--
46Locale of type 1 is 'en_US'
47Locale of type 0 is 'root'
48Locale of type 100 is false
49Locale of type -100 is false
50Locale of type -9999999999999 is false
51Locale of type 9999999999999 is false
52Locale of type 1.2 is 'en_US'
53