summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xext/intl/tests/collator_create.phpt3
-rw-r--r--ext/intl/tests/collator_create2.phpt82
-rwxr-xr-xext/intl/tests/collator_get_locale.phpt3
-rw-r--r--ext/intl/tests/collator_get_locale2.phpt51
-rwxr-xr-xext/intl/tests/dateformat_clone.phpt3
-rw-r--r--ext/intl/tests/dateformat_clone2.phpt37
-rwxr-xr-xext/intl/tests/dateformat_get_set_pattern.phpt5
-rw-r--r--ext/intl/tests/dateformat_get_set_pattern2.phpt85
-rwxr-xr-xext/intl/tests/dateformat_localtime.phpt3
-rwxr-xr-xext/intl/tests/dateformat_parse.phpt3
-rwxr-xr-xext/intl/tests/dateformat_parse_localtime_parsepos.phpt3
-rwxr-xr-xext/intl/tests/dateformat_parse_timestamp_parsepos.phpt3
-rwxr-xr-xext/intl/tests/dateformat_set_timezone_id.phpt5
-rw-r--r--ext/intl/tests/dateformat_set_timezone_id2.phpt76
-rwxr-xr-xext/intl/tests/formatter_format.phpt5
-rw-r--r--ext/intl/tests/formatter_format2.phpt130
-rwxr-xr-xext/intl/tests/formatter_format_currency.phpt5
-rw-r--r--ext/intl/tests/formatter_format_currency2.phpt50
-rwxr-xr-xext/intl/tests/formatter_get_set_attribute.phpt3
-rw-r--r--ext/intl/tests/formatter_get_set_attribute2.phpt194
-rwxr-xr-xext/intl/tests/formatter_get_set_symbol.phpt3
-rw-r--r--ext/intl/tests/formatter_get_set_symbol2.phpt190
-rwxr-xr-xext/intl/tests/locale_filter_matches.phpt3
-rw-r--r--ext/intl/tests/locale_filter_matches2.phpt366
-rwxr-xr-xext/intl/tests/locale_get_display_name.phpt3
-rw-r--r--ext/intl/tests/locale_get_display_name2.phpt342
-rwxr-xr-xext/intl/tests/locale_get_display_region.phpt3
-rw-r--r--ext/intl/tests/locale_get_display_region2.phpt275
-rwxr-xr-xext/intl/tests/locale_get_display_script.phpt5
-rw-r--r--ext/intl/tests/locale_get_display_script2.phpt275
-rwxr-xr-xext/intl/tests/locale_get_display_variant.phpt3
-rw-r--r--ext/intl/tests/locale_get_display_variant2.phpt275
-rwxr-xr-xext/intl/tests/locale_get_keywords.phpt3
-rw-r--r--ext/intl/tests/locale_get_keywords2.phpt151
-rwxr-xr-xext/intl/tests/locale_parse_locale.phpt3
-rw-r--r--ext/intl/tests/locale_parse_locale2.phpt203
-rwxr-xr-xext/intl/tests/msgfmt_fail.phpt3
-rw-r--r--ext/intl/tests/msgfmt_fail2.phpt102
-rw-r--r--ext/openssl/tests/004.phpt4
-rw-r--r--ext/openssl/tests/021.phpt13
-rw-r--r--ext/standard/tests/file/popen_pclose_basic-win32.phpt13
-rwxr-xr-xrun-tests.php377
42 files changed, 3188 insertions, 176 deletions
diff --git a/ext/intl/tests/collator_create.phpt b/ext/intl/tests/collator_create.phpt
index 49dc49492a..eed8cf1b23 100755
--- a/ext/intl/tests/collator_create.phpt
+++ b/ext/intl/tests/collator_create.phpt
@@ -1,7 +1,8 @@
--TEST--
-create()
+create() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/collator_create2.phpt b/ext/intl/tests/collator_create2.phpt
new file mode 100644
index 0000000000..90d71b0571
--- /dev/null
+++ b/ext/intl/tests/collator_create2.phpt
@@ -0,0 +1,82 @@
+--TEST--
+create() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try creating collator with different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $locales = array(
+ 'EN-US-ODESSA',
+ 'UK_UA_ODESSA',
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ '',
+ 'root',
+ 'uk@currency=EURO',
+ '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
+ );
+
+ foreach( $locales as $locale )
+ {
+ // Create Collator with the current locale.
+ $coll = ut_coll_create( $locale );
+ if( !is_object($coll) )
+ {
+ $res_str .= "Error creating collator with '$locale' locale: " .
+ intl_get_error_message() . "\n";
+ continue;
+ }
+
+ // Get the requested, valid and actual locales.
+ $vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
+ $aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
+
+ // Show them.
+ $res_str .= "Locale: '$locale'\n" .
+ " ULOC_REQUESTED_LOCALE = '$locale'\n" .
+ " ULOC_VALID_LOCALE = '$vloc'\n" .
+ " ULOC_ACTUAL_LOCALE = '$aloc'\n";
+ }
+
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECTF--
+Locale: 'EN-US-ODESSA'
+ ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
+ ULOC_VALID_LOCALE = 'en_US'
+ ULOC_ACTUAL_LOCALE = 'root'
+Locale: 'UK_UA_ODESSA'
+ ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
+ ULOC_VALID_LOCALE = 'uk_UA'
+ ULOC_ACTUAL_LOCALE = 'uk'
+Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
+ ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
+ ULOC_VALID_LOCALE = 'uk_UA'
+ ULOC_ACTUAL_LOCALE = 'uk'
+Locale: ''
+ ULOC_REQUESTED_LOCALE = ''
+ ULOC_VALID_LOCALE = '%s'
+ ULOC_ACTUAL_LOCALE = '%s'
+Locale: 'root'
+ ULOC_REQUESTED_LOCALE = 'root'
+ ULOC_VALID_LOCALE = 'root'
+ ULOC_ACTUAL_LOCALE = 'root'
+Locale: 'uk@currency=EURO'
+ ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
+ ULOC_VALID_LOCALE = 'uk'
+ ULOC_ACTUAL_LOCALE = 'uk'
+Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
diff --git a/ext/intl/tests/collator_get_locale.phpt b/ext/intl/tests/collator_get_locale.phpt
index 3f5dbaa0eb..68440f3ee7 100755
--- a/ext/intl/tests/collator_get_locale.phpt
+++ b/ext/intl/tests/collator_get_locale.phpt
@@ -1,7 +1,8 @@
--TEST--
-get_locale()
+get_locale() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/collator_get_locale2.phpt b/ext/intl/tests/collator_get_locale2.phpt
new file mode 100644
index 0000000000..798c7927f6
--- /dev/null
+++ b/ext/intl/tests/collator_get_locale2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+get_locale() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try to specify valid and invalid locale types when getting locale.
+ */
+
+function ut_main()
+{
+ $locales = array(
+ Locale::VALID_LOCALE,
+ Locale::ACTUAL_LOCALE,
+ 100,
+ -100,
+ -9999999999999,
+ 9999999999999,
+ 1.2,
+ );
+
+ $coll = ut_coll_create( 'en_US' );
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $rc = ut_coll_get_locale( $coll, $locale );
+
+ $res_str .= sprintf(
+ "Locale of type %s is %s\n",
+ dump( $locale ),
+ dump( $rc ) );
+ }
+
+ return $res_str . "\n";
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+?>
+--EXPECT--
+Locale of type 1 is 'en_US'
+Locale of type 0 is 'root'
+Locale of type 100 is false
+Locale of type -100 is false
+Locale of type -9999999999999 is false
+Locale of type 9999999999999 is false
+Locale of type 1.2 is 'en_US'
diff --git a/ext/intl/tests/dateformat_clone.phpt b/ext/intl/tests/dateformat_clone.phpt
index 886a98f17a..f060444741 100755
--- a/ext/intl/tests/dateformat_clone.phpt
+++ b/ext/intl/tests/dateformat_clone.phpt
@@ -1,7 +1,8 @@
--TEST--
-Cloning datefmt
+Cloning datefmt icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
include_once( 'ut_common.inc' );
diff --git a/ext/intl/tests/dateformat_clone2.phpt b/ext/intl/tests/dateformat_clone2.phpt
new file mode 100644
index 0000000000..c91f4b8b32
--- /dev/null
+++ b/ext/intl/tests/dateformat_clone2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Cloning datefmt icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+include_once( 'ut_common.inc' );
+$GLOBALS['oo-mode'] = true;
+$res_str = '';
+/*
+ * Clone
+ */
+$start_pattern = 'dd-MM-YY';
+$fmt = ut_datefmt_create( "en-US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern );
+
+$formatted = ut_datefmt_format($fmt,0);
+$res_str .= "\nResult of formatting timestamp=0 is : \n$formatted";
+
+$fmt_clone = clone $fmt;
+ut_datefmt_set_pattern( $fmt , 'yyyy-DDD.hh:mm:ss z' );
+
+$formatted = ut_datefmt_format($fmt,0);
+$res_str .= "\nResult of formatting timestamp=0 is : \n$formatted";
+$formatted = ut_datefmt_format($fmt_clone,0);
+$res_str .= "\nResult of clone formatting timestamp=0 is : \n$formatted";
+
+echo $res_str;
+
+?>
+--EXPECTF--
+Result of formatting timestamp=0 is :
+31-12-70
+Result of formatting timestamp=0 is :
+1969-365.07:00:00 EST
+Result of clone formatting timestamp=0 is :
+31-12-70
diff --git a/ext/intl/tests/dateformat_get_set_pattern.phpt b/ext/intl/tests/dateformat_get_set_pattern.phpt
index 6489232509..bd541c1c93 100755
--- a/ext/intl/tests/dateformat_get_set_pattern.phpt
+++ b/ext/intl/tests/dateformat_get_set_pattern.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_get_pattern_code and datefmt_set_pattern_code()
+datefmt_get_pattern_code and datefmt_set_pattern_code() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
@@ -81,4 +82,4 @@ Result of formatting timestamp=0 with the new pattern is :
Setting IntlDateFormatter with pattern = yyyyMMdd
After call to get_pattern : pattern= yyyyMMdd
Result of formatting timestamp=0 with the new pattern is :
-19691231 \ No newline at end of file
+19691231
diff --git a/ext/intl/tests/dateformat_get_set_pattern2.phpt b/ext/intl/tests/dateformat_get_set_pattern2.phpt
new file mode 100644
index 0000000000..de41f1067c
--- /dev/null
+++ b/ext/intl/tests/dateformat_get_set_pattern2.phpt
@@ -0,0 +1,85 @@
+--TEST--
+datefmt_get_pattern_code and datefmt_set_pattern_code() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+
+<?php
+
+/*
+ * Test for the datefmt_get_pattern & datefmt_set_pattern function
+ */
+
+
+function ut_main()
+{
+ $pattern_arr = array (
+ 'DD-MM-YYYY hh:mm:ss',
+ 'yyyy-DDD.hh:mm:ss z',
+ "yyyy/MM/dd",
+ "yyyyMMdd"
+ );
+
+ $res_str = '';
+
+ $start_pattern = 'dd-MM-YY';
+ $res_str .= "\nCreating IntlDateFormatter with pattern = $start_pattern ";
+ //$fmt = ut_datefmt_create( "en-US", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT , 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern );
+ $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern );
+ $pattern = ut_datefmt_get_pattern( $fmt);
+ $res_str .= "\nAfter call to get_pattern : pattern= $pattern";
+ $formatted = ut_datefmt_format($fmt,0);
+ $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted";
+
+
+ foreach( $pattern_arr as $pattern_entry )
+ {
+ $res_str .= "\n-------------------";
+ $res_str .= "\nSetting IntlDateFormatter with pattern = $pattern_entry ";
+ ut_datefmt_set_pattern( $fmt , $pattern_entry );
+ $pattern = ut_datefmt_get_pattern( $fmt);
+ $res_str .= "\nAfter call to get_pattern : pattern= $pattern";
+ $formatted = ut_datefmt_format($fmt,0);
+ $res_str .= "\nResult of formatting timestamp=0 with the new pattern is : \n$formatted";
+ $res_str .= "\n";
+
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+?>
+--EXPECT--
+Creating IntlDateFormatter with pattern = dd-MM-YY
+After call to get_pattern : pattern= dd-MM-YY
+Result of formatting timestamp=0 is :
+31-12-70
+-------------------
+Setting IntlDateFormatter with pattern = DD-MM-YYYY hh:mm:ss
+After call to get_pattern : pattern= DD-MM-YYYY hh:mm:ss
+Result of formatting timestamp=0 with the new pattern is :
+365-12-1970 07:00:00
+
+-------------------
+Setting IntlDateFormatter with pattern = yyyy-DDD.hh:mm:ss z
+After call to get_pattern : pattern= yyyy-DDD.hh:mm:ss z
+Result of formatting timestamp=0 with the new pattern is :
+1969-365.07:00:00 EST
+
+-------------------
+Setting IntlDateFormatter with pattern = yyyy/MM/dd
+After call to get_pattern : pattern= yyyy/MM/dd
+Result of formatting timestamp=0 with the new pattern is :
+1969/12/31
+
+-------------------
+Setting IntlDateFormatter with pattern = yyyyMMdd
+After call to get_pattern : pattern= yyyyMMdd
+Result of formatting timestamp=0 with the new pattern is :
+19691231
diff --git a/ext/intl/tests/dateformat_localtime.phpt b/ext/intl/tests/dateformat_localtime.phpt
index 0f04a653f4..79f297db74 100755
--- a/ext/intl/tests/dateformat_localtime.phpt
+++ b/ext/intl/tests/dateformat_localtime.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_localtime_code()
+datefmt_localtime_code() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/dateformat_parse.phpt b/ext/intl/tests/dateformat_parse.phpt
index ce800aa48a..ff59773488 100755
--- a/ext/intl/tests/dateformat_parse.phpt
+++ b/ext/intl/tests/dateformat_parse.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_parse_code()
+datefmt_parse_code() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--INI--
date.timezone="America/Los_Angeles"
--FILE--
diff --git a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
index 2256c9b364..03f99f1d92 100755
--- a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
+++ b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_parse_localtime() with parse pos
+datefmt_parse_localtime() with parse pos icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
index 040f72e47d..0f26643163 100755
--- a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
+++ b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_parse_timestamp_code() with parse pos
+datefmt_parse_timestamp_code() with parse pos icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--INI--
datetime.timezone="America/Los_Angeles"
--ENV--
diff --git a/ext/intl/tests/dateformat_set_timezone_id.phpt b/ext/intl/tests/dateformat_set_timezone_id.phpt
index 900d424fec..72a9230bdf 100755
--- a/ext/intl/tests/dateformat_set_timezone_id.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id.phpt
@@ -1,7 +1,8 @@
--TEST--
-datefmt_set_timezone_id_code()
+datefmt_set_timezone_id_code() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
@@ -72,4 +73,4 @@ Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM C
Trying to set timezone_id= CN
After call to set_timezone_id : timezone_id= CN
Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT+00:00
-Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT+00:00 \ No newline at end of file
+Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT+00:00
diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt
new file mode 100644
index 0000000000..23aacda90a
--- /dev/null
+++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt
@@ -0,0 +1,76 @@
+--TEST--
+datefmt_set_timezone_id_code() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Test for the datefmt_set_timezone_id function
+ */
+
+
+function ut_main()
+{
+ $timezone_id_arr = array (
+ 'America/New_York',
+ 'America/Los_Angeles',
+ 'America/Chicago',
+ 'CN'
+ );
+ $timestamp_entry = 0;
+
+ $res_str = '';
+
+ $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/San_Francisco' , IntlDateFormatter::GREGORIAN );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
+
+ foreach( $timezone_id_arr as $timezone_id_entry )
+ {
+
+ $res_str .= "-----------";
+ $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
+ ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
+ $formatted = ut_datefmt_format( $fmt, 0);
+ $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
+ $formatted = ut_datefmt_format( $fmt, 3600);
+ $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
+ $res_str .= "\n";
+
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+?>
+--EXPECT--
+After creation of the dateformatter : timezone_id= America/San_Francisco
+-----------
+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 7:00:00 PM Eastern Standard Time
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 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 4:00:00 PM Pacific Standard Time
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 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 6:00:00 PM Central Standard Time
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM Central Standard Time
+-----------
+Trying to set timezone_id= CN
+After call to set_timezone_id : timezone_id= CN
+Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT
+Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT
diff --git a/ext/intl/tests/formatter_format.phpt b/ext/intl/tests/formatter_format.phpt
index f47b123c82..334ef49567 100755
--- a/ext/intl/tests/formatter_format.phpt
+++ b/ext/intl/tests/formatter_format.phpt
@@ -1,7 +1,8 @@
--TEST--
-numfmt_format()
+numfmt_format() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
@@ -126,4 +127,4 @@ Locale is: en_UK
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
-Bad formatter! \ No newline at end of file
+Bad formatter!
diff --git a/ext/intl/tests/formatter_format2.phpt b/ext/intl/tests/formatter_format2.phpt
new file mode 100644
index 0000000000..0732e419dd
--- /dev/null
+++ b/ext/intl/tests/formatter_format2.phpt
@@ -0,0 +1,130 @@
+--TEST--
+numfmt_format() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Format a number using misc locales/patterns.
+ */
+
+/*
+ * TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
+ * currency and percent formatting.
+ */
+
+function ut_main()
+{
+ $styles = array(
+ NumberFormatter::PATTERN_DECIMAL => '##.#####################',
+ NumberFormatter::DECIMAL => '',
+ NumberFormatter::CURRENCY => '',
+ NumberFormatter::PERCENT => '',
+ NumberFormatter::SCIENTIFIC => '',
+ NumberFormatter::SPELLOUT => '@@@@@@@',
+ NumberFormatter::ORDINAL => '',
+ NumberFormatter::DURATION => '',
+ NumberFormatter::PATTERN_RULEBASED => '#####.###',
+ 1234999, // bad one
+ );
+
+ $integer = array(
+ NumberFormatter::ORDINAL => '',
+ NumberFormatter::DURATION => '',
+ );
+ $locales = array(
+ 'en_US',
+ 'ru_UA',
+ 'de',
+ 'fr',
+ 'en_UK'
+ );
+
+ $str_res = '';
+ $number = 1234567.891234567890000;
+
+ foreach( $locales as $locale )
+ {
+ $str_res .= "\nLocale is: $locale\n";
+ foreach( $styles as $style => $pattern )
+ {
+ $fmt = ut_nfmt_create( $locale, $style, $pattern );
+
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
+ $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
+ }
+ }
+ return $str_res;
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+
+?>
+--EXPECTREGEX--
+Locale is: en_US
+'1234567.89123457'
+'1,234,567.891'
+'\$1,234,567.89'
+'123,456,789%'
+'1.23456789123457E6'
+'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
+'1,234,567(th|ᵗʰ)'
+'342:56:07'
+'#####.###'
+Bad formatter!
+
+Locale is: ru_UA
+'1234567,89123457'
+'1 234 567,891'
+'1 234 567,89 ?(грн\.|₴)'
+'123 456 789 ?%'
+'1,23456789123457E6'
+'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
+'1 234 567.?'
+'1 234 567'
+'#####.###'
+Bad formatter!
+
+Locale is: de
+'1234567,89123457'
+'1.234.567,891'
+'(¤ )?1.234.567,89( ¤)?'
+'123\.456\.789 %'
+'1,23456789123457E6'
+'eine Million zwei­hundert­vier­und­dreißig­tausend­fünf­hundert­sieben­und­sechzig Komma acht neun eins zwei drei vier fünf sieben'
+'1.234.567.?'
+'1.234.567'
+'#####.###'
+Bad formatter!
+
+Locale is: fr
+'1234567,89123457'
+'1 234 567,891'
+'1 234 567,89 ¤'
+'123 456 789 ?%'
+'1,23456789123457E6'
+'un million deux-cent-trente-quatre-mille-cinq-cent-soixante-sept virgule huit neuf un deux trois quatre cinq sept'
+'1 234 567e'
+'1 234 567'
+'#####.###'
+Bad formatter!
+
+Locale is: en_UK
+'1234567.89123457'
+'1,234,567.891'
+'¤1,234,567.89'
+'123,456,789%'
+'1.23456789123457E6'
+'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
+'1,234,567(th|ᵗʰ)'
+'342:56:07'
+'#####.###'
+Bad formatter!
diff --git a/ext/intl/tests/formatter_format_currency.phpt b/ext/intl/tests/formatter_format_currency.phpt
index c53f831b75..be219a5baa 100755
--- a/ext/intl/tests/formatter_format_currency.phpt
+++ b/ext/intl/tests/formatter_format_currency.phpt
@@ -1,7 +1,8 @@
--TEST--
-numfmt_format_currency()
+numfmt_format_currency() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
@@ -46,4 +47,4 @@ en_UK: '£1,234,567.89'
en_US: '$1,234,567.89'
ru: '1 234 567,89 р.'
uk: '1 234 567,89 ₴'
-en: '₴1,234,567.89' \ No newline at end of file
+en: '₴1,234,567.89'
diff --git a/ext/intl/tests/formatter_format_currency2.phpt b/ext/intl/tests/formatter_format_currency2.phpt
new file mode 100644
index 0000000000..d9277f3e98
--- /dev/null
+++ b/ext/intl/tests/formatter_format_currency2.phpt
@@ -0,0 +1,50 @@
+--TEST--
+numfmt_format_currency() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Format a number using misc currencies/locales.
+ */
+/*
+ * TODO: doesn't pass on ICU 3.6 because 'ru' and 'uk' locales changed
+ * currency formatting.
+ */
+
+
+function ut_main()
+{
+ $locales = array(
+ 'en_UK' => 'GBP',
+ 'en_US' => 'USD',
+ 'ru' => 'RUR',
+ 'uk' => 'UAH',
+ 'en' => 'UAH'
+ );
+
+ $res_str = '';
+ $number = 1234567.89;
+
+ foreach( $locales as $locale => $currency )
+ {
+ $fmt = ut_nfmt_create( $locale, NumberFormatter::CURRENCY );
+ $res_str .= "$locale: " . var_export( ut_nfmt_format_currency( $fmt, $number, $currency ), true ) . "\n";
+ }
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+
+?>
+--EXPECT--
+en_UK: '£1,234,567.89'
+en_US: '$1,234,567.89'
+ru: '1 234 567,89 р.'
+uk: '1 234 567,89 ₴'
+en: 'UAH1,234,567.89'
diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt
index 95a2643439..cb5e415755 100755
--- a/ext/intl/tests/formatter_get_set_attribute.phpt
+++ b/ext/intl/tests/formatter_get_set_attribute.phpt
@@ -1,7 +1,8 @@
--TEST--
-numfmt_get/set_attribute()
+numfmt_get/set_attribute() icu < 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.2', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/formatter_get_set_attribute2.phpt b/ext/intl/tests/formatter_get_set_attribute2.phpt
new file mode 100644
index 0000000000..7d5fe69dca
--- /dev/null
+++ b/ext/intl/tests/formatter_get_set_attribute2.phpt
@@ -0,0 +1,194 @@
+--TEST--
+numfmt_get/set_attribute() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Get/set various number formatting attributes.
+ */
+
+
+function ut_main()
+{
+ // attr_name => array( attr, value )
+ $attributes = array(
+ 'PARSE_INT_ONLY' => array( NumberFormatter::PARSE_INT_ONLY, 1, 12345.123456 ),
+ 'GROUPING_USED' => array( NumberFormatter::GROUPING_USED, 0, 12345.123456 ),
+ 'DECIMAL_ALWAYS_SHOWN' => array( NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1, 12345 ),
+ 'MAX_INTEGER_DIGITS' => array( NumberFormatter::MAX_INTEGER_DIGITS, 2, 12345.123456 ),
+ 'MIN_INTEGER_DIGITS' => array( NumberFormatter::MIN_INTEGER_DIGITS, 20, 12345.123456 ),
+ 'INTEGER_DIGITS' => array( NumberFormatter::INTEGER_DIGITS, 7, 12345.123456 ),
+ 'MAX_FRACTION_DIGITS' => array( NumberFormatter::MAX_FRACTION_DIGITS, 2, 12345.123456 ),
+ 'MIN_FRACTION_DIGITS' => array( NumberFormatter::MIN_FRACTION_DIGITS, 20, 12345.123456 ),
+ 'FRACTION_DIGITS' => array( NumberFormatter::FRACTION_DIGITS, 5, 12345.123456 ),
+ 'MULTIPLIER' => array( NumberFormatter::MULTIPLIER, 2, 12345.123456 ),
+ 'GROUPING_SIZE' => array( NumberFormatter::GROUPING_SIZE, 2, 12345.123456 ),
+ 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ),
+ 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ),
+ 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ),
+ 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ),
+ 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ),
+ 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ),
+ 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ),
+ 'MAX_SIGNIFICANT_DIGITS' => array( NumberFormatter::MAX_SIGNIFICANT_DIGITS, 4, 12345.123456 ),
+ // 'LENIENT_PARSE' => array( NumberFormatter::LENIENT_PARSE, 2, 12345.123456 )
+ );
+
+ $res_str = '';
+
+ $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL );
+
+ foreach( $attributes as $attr_name => $args )
+ {
+ list( $attr, $new_val, $number ) = $args;
+ $res_str .= "\nAttribute $attr_name\n";
+
+ // Get original value of the attribute.
+ $orig_val = ut_nfmt_get_attribute( $fmt, $attr );
+
+ // Format the number using the original attribute value.
+ $rc = ut_nfmt_format( $fmt, $number );
+
+ $ps = ut_nfmt_parse( $fmt, $rc );
+
+ $res_str .= sprintf( "Old attribute value: %s ; Format result: %s ; Parse result: %s\n",
+ dump( $orig_val ),
+ dump( $rc ),
+ dump( $ps ) );
+
+ // Set new attribute value.
+ $rc = ut_nfmt_set_attribute( $fmt, $attr, $new_val );
+ if( $rc )
+ $res_str .= "Setting attribute: ok\n";
+ else
+ $res_str .= sprintf( "Setting attribute failed: %s\n", ut_nfmt_get_error_message( $fmt ) );
+
+ // Format the number using the new value.
+ $rc = ut_nfmt_format( $fmt, $number );
+
+ // Get current value of the attribute and check if it equals $new_val.
+ $attr_val_check = ut_nfmt_get_attribute( $fmt, $attr );
+ if( $attr_val_check !== $new_val )
+ $res_str .= "ERROR: New $attr_name attribute value has not been set correctly.\n";
+
+ $ps = ut_nfmt_parse( $fmt, $rc );
+
+ $res_str .= sprintf( "New attribute value: %s ; Format result: %s ; Parse result: %s\n",
+ dump( $new_val ),
+ dump( $rc ),
+ dump( $ps ) );
+
+
+ // Restore original attribute of the value
+ if( $attr != NumberFormatter::INTEGER_DIGITS && $attr != NumberFormatter::FRACTION_DIGITS
+ && $attr != NumberFormatter::FORMAT_WIDTH && $attr != NumberFormatter::SIGNIFICANT_DIGITS_USED )
+ ut_nfmt_set_attribute( $fmt, $attr, $orig_val );
+ }
+
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+
+?>
+--EXPECT--
+Attribute PARSE_INT_ONLY
+Old attribute value: 0 ; Format result: '12,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345
+
+Attribute GROUPING_USED
+Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 0 ; Format result: '12345.123' ; Parse result: 12345.123
+
+Attribute DECIMAL_ALWAYS_SHOWN
+Old attribute value: 0 ; Format result: '12,345' ; Parse result: 12345
+Setting attribute: ok
+New attribute value: 1 ; Format result: '12,345.' ; Parse result: 12345
+
+Attribute MAX_INTEGER_DIGITS
+Old attribute value: 309 ; Format result: '12,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 2 ; Format result: '45.123' ; Parse result: 45.123
+
+Attribute MIN_INTEGER_DIGITS
+Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 20 ; Format result: '00,000,000,000,000,012,345.123' ; Parse result: 12345.123
+
+Attribute INTEGER_DIGITS
+Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 7 ; Format result: '0,012,345.123' ; Parse result: 12345.123
+
+Attribute MAX_FRACTION_DIGITS
+Old attribute value: 3 ; Format result: '0,012,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 2 ; Format result: '0,012,345.12' ; Parse result: 12345.12
+
+Attribute MIN_FRACTION_DIGITS
+Old attribute value: 0 ; Format result: '0,012,345.123' ; Parse result: 12345.123
+Setting attribute: ok
+New attribute value: 20 ; Format result: '0,012,345.12345600000000000000' ; Parse result: 12345.123456
+
+Attribute FRACTION_DIGITS
+Old attribute value: 0 ; Format result: '0,012,345.123456' ; Parse result: 12345.123456
+Setting attribute: ok
+New attribute value: 5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+
+Attribute MULTIPLIER
+Old attribute value: 1 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 2 ; Format result: '0,024,690.24691' ; Parse result: 12345.123455
+
+Attribute GROUPING_SIZE
+Old attribute value: 3 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 2 ; Format result: '0,01,23,45.12346' ; Parse result: 12345.12346
+
+Attribute ROUNDING_MODE
+Old attribute value: 4 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345
+
+Attribute ROUNDING_INCREMENT
+Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346
+
+Attribute FORMAT_WIDTH
+Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346
+
+Attribute PADDING_POSITION
+Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346
+
+Attribute SECONDARY_GROUPING_SIZE
+Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 2 ; Format result: '************00,12,345.12346' ; Parse result: 12345.12346
+
+Attribute SIGNIFICANT_DIGITS_USED
+Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346
+Setting attribute: ok
+New attribute value: 1 ; Format result: '*******************12,345.1' ; Parse result: 12345.1
+
+Attribute MIN_SIGNIFICANT_DIGITS
+Old attribute value: 1 ; Format result: '**************************1' ; Parse result: 1
+Setting attribute: ok
+New attribute value: 3 ; Format result: '***********************1.00' ; Parse result: 1
+
+Attribute MAX_SIGNIFICANT_DIGITS
+Old attribute value: 6 ; Format result: '*******************12,345.1' ; Parse result: 12345.1
+Setting attribute: ok
+New attribute value: 4 ; Format result: '*********************12,350' ; Parse result: 12350
diff --git a/ext/intl/tests/formatter_get_set_symbol.phpt b/ext/intl/tests/formatter_get_set_symbol.phpt
index 40bbd25aef..050e8cf9e1 100755
--- a/ext/intl/tests/formatter_get_set_symbol.phpt
+++ b/ext/intl/tests/formatter_get_set_symbol.phpt
@@ -1,7 +1,8 @@
--TEST--
-numfmt_get/set_symbol()
+numfmt_get/set_symbol() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/formatter_get_set_symbol2.phpt b/ext/intl/tests/formatter_get_set_symbol2.phpt
new file mode 100644
index 0000000000..769713b97d
--- /dev/null
+++ b/ext/intl/tests/formatter_get_set_symbol2.phpt
@@ -0,0 +1,190 @@
+--TEST--
+numfmt_get/set_symbol() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Get/set symbol.
+ */
+
+
+function ut_main()
+{
+ $longstr = str_repeat("blah", 10);
+ $symbols = array(
+ 'DECIMAL_SEPARATOR_SYMBOL' => array( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '_._', 12345.123456, NumberFormatter::DECIMAL ),
+ 'GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '_,_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'PATTERN_SEPARATOR_SYMBOL' => array( NumberFormatter::PATTERN_SEPARATOR_SYMBOL, '_;_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'PERCENT_SYMBOL' => array( NumberFormatter::PERCENT_SYMBOL, '_%_', 12345.123456, NumberFormatter::PERCENT ),
+ 'ZERO_DIGIT_SYMBOL' => array( NumberFormatter::ZERO_DIGIT_SYMBOL, '_ZD_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'DIGIT_SYMBOL' => array( NumberFormatter::DIGIT_SYMBOL, '_DS_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'MINUS_SIGN_SYMBOL' => array( NumberFormatter::MINUS_SIGN_SYMBOL, '_-_', -12345.123456, NumberFormatter::DECIMAL ),
+ 'PLUS_SIGN_SYMBOL' => array( NumberFormatter::PLUS_SIGN_SYMBOL, '_+_', 12345.123456, NumberFormatter::SCIENTIFIC ),
+ 'CURRENCY_SYMBOL' => array( NumberFormatter::CURRENCY_SYMBOL, '_$_', 12345.123456, NumberFormatter::CURRENCY ),
+ 'INTL_CURRENCY_SYMBOL' => array( NumberFormatter::INTL_CURRENCY_SYMBOL, '_$_', 12345.123456, NumberFormatter::CURRENCY ),
+ 'MONETARY_SEPARATOR_SYMBOL' => array( NumberFormatter::MONETARY_SEPARATOR_SYMBOL, '_MS_', 12345.123456, NumberFormatter::CURRENCY ),
+ 'EXPONENTIAL_SYMBOL' => array( NumberFormatter::EXPONENTIAL_SYMBOL, '_E_', 12345.123456, NumberFormatter::SCIENTIFIC ),
+ 'PERMILL_SYMBOL' => array( NumberFormatter::PERMILL_SYMBOL, '_PS_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'PAD_ESCAPE_SYMBOL' => array( NumberFormatter::PAD_ESCAPE_SYMBOL, '_PE_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'INFINITY_SYMBOL' => array( NumberFormatter::INFINITY_SYMBOL, '_IS_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'NAN_SYMBOL' => array( NumberFormatter::NAN_SYMBOL, '_N_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'SIGNIFICANT_DIGIT_SYMBOL' => array( NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, '_SD_', 12345.123456, NumberFormatter::DECIMAL ),
+ 'MONETARY_GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, '_MG_', 12345.123456, NumberFormatter::CURRENCY ),
+ 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, "&nbsp;", 12345.123456, NumberFormatter::CURRENCY ),
+ 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ),
+ );
+
+ $res_str = '';
+
+ foreach( $symbols as $symb_name => $data )
+ {
+ list( $symb, $new_val, $number, $attr ) = $data;
+
+ $fmt = ut_nfmt_create( 'en_US', $attr);
+
+ $res_str .= "\nSymbol '$symb_name'\n";
+
+ // Get original symbol value.
+ $orig_val = ut_nfmt_get_symbol( $fmt, $symb );
+ $res_str .= "Default symbol: [$orig_val]\n";
+
+ // Set a new symbol value.
+ $res_val = ut_nfmt_set_symbol( $fmt, $symb, $new_val );
+ if( !$res_val )
+ $res_str .= "set_symbol() error: " . ut_nfmt_get_error_message( $fmt ) . "\n";
+
+ // Get the symbol value back.
+ $new_val_check = ut_nfmt_get_symbol( $fmt, $symb );
+ if( !$new_val_check )
+ $res_str .= "get_symbol() error: " . ut_nfmt_get_error_message( $fmt ) . "\n";
+
+ $res_str .= "New symbol: [$new_val_check]\n";
+
+ // Check if the new value has been set.
+ if( $new_val_check !== $new_val )
+ $res_str .= "ERROR: New $symb_name symbol value has not been set correctly.\n";
+
+ // Format the number using the new value.
+ $s = ut_nfmt_format( $fmt, $number );
+ $res_str .= "A number formatted with the new symbol: $s\n";
+
+ // Restore attribute's symbol.
+ ut_nfmt_set_symbol( $fmt, $symb, $orig_val );
+ }
+ $badvals = array(2147483648, -2147483648, -1, 4294901761);
+ foreach($badvals as $badval) {
+ if(ut_nfmt_get_symbol( $fmt, 2147483648 )) {
+ $res_str .= "Bad value $badval should return false!\n";
+ }
+ }
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECT--
+Symbol 'DECIMAL_SEPARATOR_SYMBOL'
+Default symbol: [.]
+New symbol: [_._]
+A number formatted with the new symbol: 12,345_._123
+
+Symbol 'GROUPING_SEPARATOR_SYMBOL'
+Default symbol: [,]
+New symbol: [_,_]
+A number formatted with the new symbol: 12_,_345.123
+
+Symbol 'PATTERN_SEPARATOR_SYMBOL'
+Default symbol: [;]
+New symbol: [_;_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'PERCENT_SYMBOL'
+Default symbol: [%]
+New symbol: [_%_]
+A number formatted with the new symbol: 1,234,512_%_
+
+Symbol 'ZERO_DIGIT_SYMBOL'
+Default symbol: [0]
+New symbol: [_ZD_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'DIGIT_SYMBOL'
+Default symbol: [#]
+New symbol: [_DS_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'MINUS_SIGN_SYMBOL'
+Default symbol: [-]
+New symbol: [_-_]
+A number formatted with the new symbol: _-_12,345.123
+
+Symbol 'PLUS_SIGN_SYMBOL'
+Default symbol: [+]
+New symbol: [_+_]
+A number formatted with the new symbol: 1.2345123456E4
+
+Symbol 'CURRENCY_SYMBOL'
+Default symbol: [$]
+New symbol: [_$_]
+A number formatted with the new symbol: _$_12,345.12
+
+Symbol 'INTL_CURRENCY_SYMBOL'
+Default symbol: [USD]
+New symbol: [_$_]
+A number formatted with the new symbol: $12,345.12
+
+Symbol 'MONETARY_SEPARATOR_SYMBOL'
+Default symbol: [.]
+New symbol: [_MS_]
+A number formatted with the new symbol: $12,345_MS_12
+
+Symbol 'EXPONENTIAL_SYMBOL'
+Default symbol: [E]
+New symbol: [_E_]
+A number formatted with the new symbol: 1.2345123456_E_4
+
+Symbol 'PERMILL_SYMBOL'
+Default symbol: [‰]
+New symbol: [_PS_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'PAD_ESCAPE_SYMBOL'
+Default symbol: [*]
+New symbol: [_PE_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'INFINITY_SYMBOL'
+Default symbol: [∞]
+New symbol: [_IS_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'NAN_SYMBOL'
+Default symbol: [NaN]
+New symbol: [_N_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'SIGNIFICANT_DIGIT_SYMBOL'
+Default symbol: [@]
+New symbol: [_SD_]
+A number formatted with the new symbol: 12,345.123
+
+Symbol 'MONETARY_GROUPING_SEPARATOR_SYMBOL'
+Default symbol: [,]
+New symbol: [_MG_]
+A number formatted with the new symbol: $12_MG_345.12
+
+Symbol 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2'
+Default symbol: [,]
+New symbol: [&nbsp;]
+A number formatted with the new symbol: $12&nbsp;345.12
+
+Symbol 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3'
+Default symbol: [,]
+New symbol: [blahblahblahblahblahblahblahblahblahblah]
+A number formatted with the new symbol: $12blahblahblahblahblahblahblahblahblahblah345.12
+
diff --git a/ext/intl/tests/locale_filter_matches.phpt b/ext/intl/tests/locale_filter_matches.phpt
index 19e760e8a4..cada499b9a 100755
--- a/ext/intl/tests/locale_filter_matches.phpt
+++ b/ext/intl/tests/locale_filter_matches.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_filter_matches.phpt()
+locale_filter_matches.phpt() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_filter_matches2.phpt b/ext/intl/tests/locale_filter_matches2.phpt
new file mode 100644
index 0000000000..37f9e5a377
--- /dev/null
+++ b/ext/intl/tests/locale_filter_matches2.phpt
@@ -0,0 +1,366 @@
+--TEST--
+locale_filter_matches.phpt() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try parsing different Locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $loc_ranges = array(
+ 'de-de',
+ 'sl_IT',
+ 'sl_IT_Nedis',
+ 'jbo',
+ 'art-lojban',
+ 'sl_IT'
+ );
+
+ $lang_tags = array(
+ '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'
+ );
+
+ $res_str = '';
+ $isCanonical = false;
+ foreach($loc_ranges as $loc_range){
+ foreach($lang_tags as $lang_tag){
+ $res_str .="--------------\n";
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
+ $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
+//canonicalized version
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
+ $can_loc_range = ut_loc_canonicalize($loc_range);
+ $can_lang_tag = ut_loc_canonicalize($lang_tag);
+ $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
+ }
+ }
+
+ $res_str .= "\n";
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--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 jbo ? 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 jbo ? 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 jbo ? 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 jbo ? 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 jbo ? 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 jbo ? 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 jbo ? YES
+--------------
+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 jbo ? YES
+--------------
+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:jbo canonically matches lang_tag de_Deva ? NO
+--------------
+loc_range:art-lojban matches lang_tag de-DE-1996 ? NO
+loc_range:jbo canonically matches lang_tag de_DE_1996 ? NO
+--------------
+loc_range:art-lojban matches lang_tag de-DE ? NO
+loc_range:jbo canonically matches lang_tag de_DE ? NO
+--------------
+loc_range:art-lojban matches lang_tag zh_Hans ? NO
+loc_range:jbo canonically matches lang_tag zh_Hans ? NO
+--------------
+loc_range:art-lojban matches lang_tag de-CH-1996 ? NO
+loc_range:jbo canonically matches lang_tag de_CH_1996 ? NO
+--------------
+loc_range:art-lojban matches lang_tag sl_IT ? NO
+loc_range:jbo canonically matches lang_tag sl_IT ? NO
+--------------
+loc_range:art-lojban 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:art-lojban matches lang_tag sl_IT_rozaj ? NO
+loc_range:jbo canonically matches lang_tag sl_IT_ROZAJ ? NO
+--------------
+loc_range:art-lojban matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
+loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
+--------------
+loc_range:art-lojban matches lang_tag i-enochian ? NO
+loc_range:jbo canonically matches lang_tag @x=i-enochian ? NO
+--------------
+loc_range:art-lojban matches lang_tag sgn-CH-de ? NO
+loc_range:jbo canonically matches lang_tag sgn_CH_DE ? NO
+--------------
+loc_range:art-lojban matches lang_tag art-lojban ? YES
+loc_range:jbo canonically matches lang_tag jbo ? YES
+--------------
+loc_range:art-lojban matches lang_tag i-lux ? NO
+loc_range:jbo canonically matches lang_tag lb ? NO
+--------------
+loc_range:art-lojban matches lang_tag art-lojban ? YES
+loc_range:jbo canonically matches lang_tag jbo ? YES
+--------------
+loc_range:art-lojban matches lang_tag jbo ? NO
+loc_range:jbo canonically matches lang_tag jbo ? YES
+--------------
+loc_range:art-lojban matches lang_tag en_sl_IT ? NO
+loc_range:jbo 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 jbo ? 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 jbo ? 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_name.phpt b/ext/intl/tests/locale_get_display_name.phpt
index cf89498657..b128734277 100755
--- a/ext/intl/tests/locale_get_display_name.phpt
+++ b/ext/intl/tests/locale_get_display_name.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_get_display_name()
+locale_get_display_name() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_get_display_name2.phpt b/ext/intl/tests/locale_get_display_name2.phpt
new file mode 100644
index 0000000000..40ccc0c2c5
--- /dev/null
+++ b/ext/intl/tests/locale_get_display_name2.phpt
@@ -0,0 +1,342 @@
+--TEST--
+locale_get_display_name() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try getting the display_name for different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str='';
+
+ $disp_locales=array('en','fr','de');
+
+ $locales = array(
+ 'sl_IT_nedis_KIRTI',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'zh-hakka',
+ 'zh-wuu',
+ 'i-tay',
+ 'sgn-BE-nl',
+ 'sgn-CH-de',
+ 'sl_IT_rozaj@currency=EUR',
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'x-whatever',
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
+ $res_str .= "-----------------\n";
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--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, Devise=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, Devise#
+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 #Devise=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 #idéogrammes han (#variante traditionnelle#|traditionnels)#
+disp_locale=de : display_name=Chinesisch #Traditionell#
+-----------------
+locale='zh-Hans'
+disp_locale=en : display_name=Chinese #Simplified#
+disp_locale=fr : display_name=chinois #idéogrammes han (#variante simplifiée#|simplifiés)#
+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 #idéogrammes han (#variante simplifiée#|simplifiés), Chine#
+disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
+-----------------
+locale='sr-Latn-CS'
+disp_locale=en : display_name=Serbian #Latin, Serbia [aA]nd Montenegro#
+disp_locale=fr : display_name=serbe #latin, Serbie-et-Monténégro#
+disp_locale=de : display_name=Serbisch #Lateinisch, Serbien und Montenegro#
+-----------------
+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 [aA]nd Montenegro#
+disp_locale=fr : display_name=serbe #Qaaa, Serbie-et-Monténégro#
+disp_locale=de : display_name=Serbisch #Qaaa, Serbien und Montenegro#
+-----------------
+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_region.phpt b/ext/intl/tests/locale_get_display_region.phpt
index 48cd7b6c7f..9a6e75d94a 100755
--- a/ext/intl/tests/locale_get_display_region.phpt
+++ b/ext/intl/tests/locale_get_display_region.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_get_display_region()
+locale_get_display_region() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_get_display_region2.phpt b/ext/intl/tests/locale_get_display_region2.phpt
new file mode 100644
index 0000000000..f1b584188a
--- /dev/null
+++ b/ext/intl/tests/locale_get_display_region2.phpt
@@ -0,0 +1,275 @@
+--TEST--
+locale_get_display_region() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try getting the display_region for different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $disp_locales=array('en','fr','de');
+
+ $locales = array(
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'x-whatever',
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_region( $locale ,$disp_locale );
+ $res_str .= "disp_locale=$disp_locale : display_region=$scr";
+ $res_str .= "\n";
+ }
+ $res_str .= "-----------------\n";
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--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 [Aa]nd Montenegro
+disp_locale=fr : display_region=Serbie-et-Monténégro
+disp_locale=de : display_region=Serbien und Montenegro
+-----------------
+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 [Aa]nd Montenegro
+disp_locale=fr : display_region=Serbie-et-Monténégro
+disp_locale=de : display_region=Serbien und Montenegro
+-----------------
+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_get_display_script.phpt b/ext/intl/tests/locale_get_display_script.phpt
index 916441b5fa..0440dfb204 100755
--- a/ext/intl/tests/locale_get_display_script.phpt
+++ b/ext/intl/tests/locale_get_display_script.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_get_display_script()
+locale_get_display_script() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
@@ -271,4 +272,4 @@ locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
------------------ \ No newline at end of file
+-----------------
diff --git a/ext/intl/tests/locale_get_display_script2.phpt b/ext/intl/tests/locale_get_display_script2.phpt
new file mode 100644
index 0000000000..92652bde90
--- /dev/null
+++ b/ext/intl/tests/locale_get_display_script2.phpt
@@ -0,0 +1,275 @@
+--TEST--
+locale_get_display_script() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try getting the display_script for different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $disp_locales=array('en','fr','de');
+
+ $locales = array(
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'x-whatever',
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_script( $locale ,$disp_locale );
+ $res_str .= "disp_locale=$disp_locale : display_script=$scr";
+ $res_str .= "\n";
+ }
+ $res_str .= "-----------------\n";
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECTREGEX--
+locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='root'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='uk@currency=EURO'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='Hindi'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='de'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='fr'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='ja'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='i-enochian'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='zh-Hant'
+disp_locale=en : display_script=Traditional
+disp_locale=fr : display_script=idéogrammes han (\(variante traditionnelle\)|traditionnels)
+disp_locale=de : display_script=Traditionell
+-----------------
+locale='zh-Hans'
+disp_locale=en : display_script=Simplified
+disp_locale=fr : display_script=idéogrammes han (\(variante simplifiée\)|simplifiés)
+disp_locale=de : display_script=Vereinfacht
+-----------------
+locale='sr-Cyrl'
+disp_locale=en : display_script=Cyrillic
+disp_locale=fr : display_script=cyrillique
+disp_locale=de : display_script=Kyrillisch
+-----------------
+locale='sr-Latn'
+disp_locale=en : display_script=Latin
+disp_locale=fr : display_script=latin
+disp_locale=de : display_script=Lateinisch
+-----------------
+locale='zh-Hans-CN'
+disp_locale=en : display_script=Simplified
+disp_locale=fr : display_script=idéogrammes han (\(variante simplifiée\)|simplifiés)
+disp_locale=de : display_script=Vereinfacht
+-----------------
+locale='sr-Latn-CS'
+disp_locale=en : display_script=Latin
+disp_locale=fr : display_script=latin
+disp_locale=de : display_script=Lateinisch
+-----------------
+locale='sl-rozaj'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='sl-nedis'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='de-CH-1901'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='sl-IT-nedis'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='sl-Latn-IT-nedis'
+disp_locale=en : display_script=Latin
+disp_locale=fr : display_script=latin
+disp_locale=de : display_script=Lateinisch
+-----------------
+locale='de-DE'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='en-US'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='es-419'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='de-CH-x-phonebk'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='az-Arab-x-AZE-derbend'
+disp_locale=en : display_script=Arabic
+disp_locale=fr : display_script=arabe
+disp_locale=de : display_script=Arabisch
+-----------------
+locale='zh-min'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='zh-min-nan-Hant-CN'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='x-whatever'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='qaa-Qaaa-QM-x-southern'
+disp_locale=en : display_script=Qaaa
+disp_locale=fr : display_script=Qaaa
+disp_locale=de : display_script=Qaaa
+-----------------
+locale='sr-Latn-QM'
+disp_locale=en : display_script=Latin
+disp_locale=fr : display_script=latin
+disp_locale=de : display_script=Lateinisch
+-----------------
+locale='sr-Qaaa-CS'
+disp_locale=en : display_script=Qaaa
+disp_locale=fr : display_script=Qaaa
+disp_locale=de : display_script=Qaaa
+-----------------
+locale='en-US-u-islamCal'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='zh-CN-a-myExt-x-private'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='en-a-myExt-b-another'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='de-419-DE'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='a-DE'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
+locale='ar-a-aaa-b-bbb-a-ccc'
+disp_locale=en : display_script=
+disp_locale=fr : display_script=
+disp_locale=de : display_script=
+-----------------
diff --git a/ext/intl/tests/locale_get_display_variant.phpt b/ext/intl/tests/locale_get_display_variant.phpt
index 25bfef15d0..9f72ee0498 100755
--- a/ext/intl/tests/locale_get_display_variant.phpt
+++ b/ext/intl/tests/locale_get_display_variant.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_get_display_variant()
+locale_get_display_variant() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_get_display_variant2.phpt b/ext/intl/tests/locale_get_display_variant2.phpt
new file mode 100644
index 0000000000..2517240e30
--- /dev/null
+++ b/ext/intl/tests/locale_get_display_variant2.phpt
@@ -0,0 +1,275 @@
+--TEST--
+locale_get_display_variant() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try getting the display_variant for different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $disp_locales=array('en','fr','de');
+
+ $locales = array(
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'x-whatever',
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_variant( $locale ,$disp_locale );
+ $res_str .= "disp_locale=$disp_locale : display_variant=$scr";
+ $res_str .= "\n";
+ }
+ $res_str .= "-----------------\n";
+ }
+
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECTREGEX--
+locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
+disp_locale=en : display_variant=CALIFORNIA
+disp_locale=fr : display_variant=CALIFORNIA
+disp_locale=de : display_variant=CALIFORNIA
+-----------------
+locale='root'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='uk@currency=EURO'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='Hindi'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='de'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='fr'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='ja'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='i-enochian'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='zh-Hant'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='zh-Hans'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sr-Cyrl'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sr-Latn'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='zh-Hans-CN'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sr-Latn-CS'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sl-rozaj'
+disp_locale=en : display_variant=Resian
+disp_locale=fr : display_variant=dialecte de Resia
+disp_locale=de : display_variant=Resianisch
+-----------------
+locale='sl-nedis'
+disp_locale=en : display_variant=Natisone dialect
+disp_locale=fr : display_variant=dialecte de Natisone
+disp_locale=de : display_variant=Natisone-Dialekt
+-----------------
+locale='de-CH-1901'
+disp_locale=en : display_variant=Traditional German orthography
+disp_locale=fr : display_variant=orthographe allemande traditionnelle
+disp_locale=de : display_variant=(1901|[Aa]lte deutsche Rechtschreibung)
+-----------------
+locale='sl-IT-nedis'
+disp_locale=en : display_variant=Natisone dialect
+disp_locale=fr : display_variant=dialecte de Natisone
+disp_locale=de : display_variant=(NEDIS|Natisone-Dialekt)
+-----------------
+locale='sl-Latn-IT-nedis'
+disp_locale=en : display_variant=Natisone dialect
+disp_locale=fr : display_variant=dialecte de Natisone
+disp_locale=de : display_variant=(NEDIS|Natisone-Dialekt)
+-----------------
+locale='de-DE'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='en-US'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='es-419'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='de-CH-x-phonebk'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='az-Arab-x-AZE-derbend'
+disp_locale=en : display_variant=(AZE_DERBEND)?
+disp_locale=fr : display_variant=(AZE_DERBEND)?
+disp_locale=de : display_variant=(AZE_DERBEND)?
+-----------------
+locale='zh-min'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='zh-min-nan-Hant-CN'
+disp_locale=en : display_variant=NAN_HANT_CN
+disp_locale=fr : display_variant=NAN_HANT_CN
+disp_locale=de : display_variant=NAN_HANT_CN
+-----------------
+locale='x-whatever'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='qaa-Qaaa-QM-x-southern'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sr-Latn-QM'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='sr-Qaaa-CS'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='en-US-u-islamCal'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='zh-CN-a-myExt-x-private'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='en-a-myExt-b-another'
+disp_locale=en : display_variant=(MYEXT_B_ANOTHER)?
+disp_locale=fr : display_variant=(MYEXT_B_ANOTHER)?
+disp_locale=de : display_variant=(MYEXT_B_ANOTHER)?
+-----------------
+locale='de-419-DE'
+disp_locale=en : display_variant=DE
+disp_locale=fr : display_variant=DE
+disp_locale=de : display_variant=DE
+-----------------
+locale='a-DE'
+disp_locale=en : display_variant=
+disp_locale=fr : display_variant=
+disp_locale=de : display_variant=
+-----------------
+locale='ar-a-aaa-b-bbb-a-ccc'
+disp_locale=en : display_variant=(AAA_B_BBB_A_CCC)?
+disp_locale=fr : display_variant=(AAA_B_BBB_A_CCC)?
+disp_locale=de : display_variant=(AAA_B_BBB_A_CCC)?
+-----------------
diff --git a/ext/intl/tests/locale_get_keywords.phpt b/ext/intl/tests/locale_get_keywords.phpt
index 5dec0011e9..4a09f54d36 100755
--- a/ext/intl/tests/locale_get_keywords.phpt
+++ b/ext/intl/tests/locale_get_keywords.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_get_keywords()
+locale_get_keywords() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_get_keywords2.phpt b/ext/intl/tests/locale_get_keywords2.phpt
new file mode 100644
index 0000000000..7bcaca1897
--- /dev/null
+++ b/ext/intl/tests/locale_get_keywords2.phpt
@@ -0,0 +1,151 @@
+--TEST--
+locale_get_keywords() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try getting the keywords for different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $locales = array(
+ "de_DE@currency=EUR;collation=PHONEBOOK",
+ 'uk-ua_CALIFORNIA@currency=GRN'
+ );
+
+ $locales = array(
+ 'de_DE@currency=EUR;collation=PHONEBOOK',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'x-whatever',
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $keywords_arr = ut_loc_get_keywords( $locale);
+ $res_str .= "$locale: ";
+ if( $keywords_arr){
+ foreach( $keywords_arr as $key => $value){
+ $res_str .= "Key is $key and Value is $value \n";
+ }
+ }
+ else{
+ $res_str .= "No keywords found.";
+ }
+ $res_str .= "\n";
+ }
+
+ $res_str .= "\n";
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECT--
+de_DE@currency=EUR;collation=PHONEBOOK: Key is collation and Value is PHONEBOOK
+Key is currency and Value is EUR
+
+root: No keywords found.
+uk@currency=EURO: Key is currency and Value is EURO
+
+Hindi: No keywords found.
+de: No keywords found.
+fr: No keywords found.
+ja: No keywords found.
+i-enochian: Key is x and Value is i-enochian
+
+zh-Hant: No keywords found.
+zh-Hans: No keywords found.
+sr-Cyrl: No keywords found.
+sr-Latn: No keywords found.
+zh-Hans-CN: No keywords found.
+sr-Latn-CS: No keywords found.
+sl-rozaj: No keywords found.
+sl-nedis: No keywords found.
+de-CH-1901: No keywords found.
+sl-IT-nedis: No keywords found.
+sl-Latn-IT-nedis: No keywords found.
+de-DE: No keywords found.
+en-US: No keywords found.
+es-419: No keywords found.
+de-CH-x-phonebk: Key is x and Value is phonebk
+
+az-Arab-x-AZE-derbend: Key is x and Value is aze-derbend
+
+zh-min: No keywords found.
+zh-min-nan-Hant-CN: No keywords found.
+x-whatever: Key is x and Value is whatever
+
+qaa-Qaaa-QM-x-southern: Key is x and Value is southern
+
+sr-Latn-QM: No keywords found.
+sr-Qaaa-CS: No keywords found.
+en-US-u-islamCal: Key is attribute and Value is islamcal
+
+zh-CN-a-myExt-x-private: Key is a and Value is myext
+Key is x and Value is private
+
+en-a-myExt-b-another: Key is a and Value is myext
+Key is b and Value is another
+
+de-419-DE: No keywords found.
+a-DE: No keywords found.
+ar-a-aaa-b-bbb-a-ccc: Key is a and Value is aaa
+Key is b and Value is bbb
diff --git a/ext/intl/tests/locale_parse_locale.phpt b/ext/intl/tests/locale_parse_locale.phpt
index 36637f0d81..c8aa2f4123 100755
--- a/ext/intl/tests/locale_parse_locale.phpt
+++ b/ext/intl/tests/locale_parse_locale.phpt
@@ -1,7 +1,8 @@
--TEST--
-locale_parse_locale()
+locale_parse_locale() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/locale_parse_locale2.phpt b/ext/intl/tests/locale_parse_locale2.phpt
new file mode 100644
index 0000000000..6012862a48
--- /dev/null
+++ b/ext/intl/tests/locale_parse_locale2.phpt
@@ -0,0 +1,203 @@
+--TEST--
+locale_parse_locale() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Try parsing different Locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $locales = array(
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ 'root',
+ 'uk@currency=EURO',
+ 'Hindi',
+//Simple language subtag
+ 'de',
+ 'fr',
+ 'ja',
+ 'i-enochian', //(example of a grandfathered tag)
+//Language subtag plus Script subtag:
+ 'zh-Hant',
+ 'zh-Hans',
+ 'sr-Cyrl',
+ 'sr-Latn',
+//Language-Script-Region
+ 'zh-Hans-CN',
+ 'sr-Latn-CS',
+//Language-Variant
+ 'sl-rozaj',
+ 'sl-nedis',
+//Language-Region-Variant
+ 'de-CH-1901',
+ 'sl-IT-nedis',
+//Language-Script-Region-Variant
+ 'sl-Latn-IT-nedis',
+//Language-Region:
+ 'de-DE',
+ 'en-US',
+ 'es-419',
+//Private use subtags:
+ 'de-CH-x-phonebk',
+ 'az-Arab-x-AZE-derbend',
+//Extended language subtags
+ 'zh-min',
+ 'zh-min-nan-Hant-CN',
+//Private use registry values
+ 'qaa-Qaaa-QM-x-southern',
+ 'sr-Latn-QM',
+ 'sr-Qaaa-CS',
+/*Tags that use extensions (examples ONLY: extensions MUST be defined
+ by revision or update to this document or by RFC): */
+ 'en-US-u-islamCal',
+ 'zh-CN-a-myExt-x-private',
+ 'en-a-myExt-b-another',
+//Some Invalid Tags:
+ 'de-419-DE',
+ 'a-DE',
+ 'ar-a-aaa-b-bbb-a-ccc'
+ );
+
+
+ $res_str = '';
+
+ foreach( $locales as $locale )
+ {
+ $arr = ut_loc_locale_parse( $locale);
+ $res_str .= "---------------------\n";
+ $res_str .= "$locale:\n";
+ if( $arr){
+ foreach( $arr as $key => $value){
+ $res_str .= "$key : '$value' , ";
+ }
+ $res_str = rtrim($res_str);
+ }
+ else{
+ $res_str .= "No values found from Locale parsing.";
+ }
+ $res_str .= "\n";
+ }
+
+ $res_str .= "\n";
+ return $res_str;
+
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECTF--
+---------------------
+uk-ua_CALIFORNIA@currency=;currency=GRN:
+language : 'uk' , region : 'UA' , variant0 : 'CALIFORNIA' ,
+---------------------
+root:
+language : 'root' ,
+---------------------
+uk@currency=EURO:
+language : 'uk' ,
+---------------------
+Hindi:
+language : 'hindi' ,
+---------------------
+de:
+language : 'de' ,
+---------------------
+fr:
+language : 'fr' ,
+---------------------
+ja:
+language : 'ja' ,
+---------------------
+i-enochian:
+grandfathered : 'i-enochian' ,
+---------------------
+zh-Hant:
+language : 'zh' , script : 'Hant' ,
+---------------------
+zh-Hans:
+language : 'zh' , script : 'Hans' ,
+---------------------
+sr-Cyrl:
+language : 'sr' , script : 'Cyrl' ,
+---------------------
+sr-Latn:
+language : 'sr' , script : 'Latn' ,
+---------------------
+zh-Hans-CN:
+language : 'zh' , script : 'Hans' , region : 'CN' ,
+---------------------
+sr-Latn-CS:
+language : 'sr' , script : 'Latn' , region : 'CS' ,
+---------------------
+sl-rozaj:
+language : 'sl' , variant0 : 'ROZAJ' ,
+---------------------
+sl-nedis:
+language : 'sl' , variant0 : 'NEDIS' ,
+---------------------
+de-CH-1901:
+language : 'de' , region : 'CH' , variant0 : '1901' ,
+---------------------
+sl-IT-nedis:
+language : 'sl' , region : 'IT' , variant0 : 'NEDIS' ,
+---------------------
+sl-Latn-IT-nedis:
+language : 'sl' , script : 'Latn' , region : 'IT' , variant0 : 'NEDIS' ,
+---------------------
+de-DE:
+language : 'de' , region : 'DE' ,
+---------------------
+en-US:
+language : 'en' , region : 'US' ,
+---------------------
+es-419:
+language : 'es' , region : '419' ,
+---------------------
+de-CH-x-phonebk:
+language : 'de' , region : 'CH' , private0 : 'phonebk' ,
+---------------------
+az-Arab-x-AZE-derbend:
+language : 'az' , script : 'Arab' , private0 : 'AZE' , private1 : 'derbend' ,
+---------------------
+zh-min:
+grandfathered : 'zh-min' ,
+---------------------
+zh-min-nan-Hant-CN:
+language : 'zh' , region : 'MIN' , variant0 : 'NAN' , variant1 : 'HANT' , variant2 : 'CN' ,
+---------------------
+qaa-Qaaa-QM-x-southern:
+language : 'qaa' , script : 'Qaaa' , region : 'QM' , private0 : 'southern' ,
+---------------------
+sr-Latn-QM:
+language : 'sr' , script : 'Latn' , region : 'QM' ,
+---------------------
+sr-Qaaa-CS:
+language : 'sr' , script : 'Qaaa' , region : 'CS' ,
+---------------------
+en-US-u-islamCal:
+language : 'en' , region : 'US' ,
+---------------------
+zh-CN-a-myExt-x-private:
+language : 'zh' , region : 'CN' , private0 : 'private' ,
+---------------------
+en-a-myExt-b-another:
+language : 'en' ,
+---------------------
+de-419-DE:
+language : 'de' , region : '419' , variant0 : 'DE' ,
+---------------------
+a-DE:
+No values found from Locale parsing.
+---------------------
+ar-a-aaa-b-bbb-a-ccc:
+language : 'ar' ,
diff --git a/ext/intl/tests/msgfmt_fail.phpt b/ext/intl/tests/msgfmt_fail.phpt
index c26a54e9ef..bffb71c56d 100755
--- a/ext/intl/tests/msgfmt_fail.phpt
+++ b/ext/intl/tests/msgfmt_fail.phpt
@@ -1,7 +1,8 @@
--TEST--
-msgfmt creation failures
+msgfmt creation failures icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt
new file mode 100644
index 0000000000..eee2424a50
--- /dev/null
+++ b/ext/intl/tests/msgfmt_fail2.phpt
@@ -0,0 +1,102 @@
+--TEST--
+msgfmt creation failures icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+function err($fmt) {
+ if(!$fmt) {
+ echo var_export(intl_get_error_message(), true)."\n";
+ }
+}
+
+function crt($t, $l, $s) {
+ switch(true) {
+ case $t == "O":
+ return new MessageFormatter($l, $s);
+ break;
+ case $t == "C":
+ return MessageFormatter::create($l, $s);
+ break;
+ case $t == "P":
+ return msgfmt_create($l, $s);
+ break;
+ }
+}
+
+$args = array(
+ array(null, null),
+ array("whatever", "{0,whatever}"),
+ array(array(), array()),
+ array("en", "{0,choice}"),
+ array("fr", "{0,"),
+ array("en_US", "\xD0"),
+);
+
+$fmt = new MessageFormatter();
+err($fmt);
+$fmt = msgfmt_create();
+err($fmt);
+$fmt = MessageFormatter::create();
+err($fmt);
+$fmt = new MessageFormatter('en');
+err($fmt);
+$fmt = msgfmt_create('en');
+err($fmt);
+$fmt = MessageFormatter::create('en');
+err($fmt);
+
+foreach($args as $arg) {
+ $fmt = crt("O", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("C", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("P", $arg[0], $arg[1]);
+ err($fmt);
+}
+
+?>
+--EXPECTF--
+Warning: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+
+Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
+'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
+'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
+'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
+'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
+'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
+'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
+'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
+'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
diff --git a/ext/openssl/tests/004.phpt b/ext/openssl/tests/004.phpt
index b9c41590cf..aca9818ad1 100644
--- a/ext/openssl/tests/004.phpt
+++ b/ext/openssl/tests/004.phpt
@@ -9,12 +9,12 @@ $a = 1;
var_dump(openssl_csr_new(1,$a));
var_dump(openssl_csr_new(1,$a,1,1));
$a = array();
-var_dump(openssl_csr_new(array(), $a, array(), array()));
+var_dump(openssl_csr_new(array(), $a, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'), array()));
//this leaks
$a = array(1,2);
$b = array(1,2);
-var_dump(openssl_csr_new($a, $b));
+var_dump(openssl_csr_new($a, $b, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf')));
echo "Done\n";
diff --git a/ext/openssl/tests/021.phpt b/ext/openssl/tests/021.phpt
index 00e2158f8d..391b6a5279 100644
--- a/ext/openssl/tests/021.phpt
+++ b/ext/openssl/tests/021.phpt
@@ -8,6 +8,8 @@ $cert = "file://" . dirname(__FILE__) . "/cert.crt";
$priv = "file://" . dirname(__FILE__) . "/private.key";
$wrong = "wrong";
$pub = "file://" . dirname(__FILE__) . "/public.key";
+$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
+$config_arg = array('config' => $config);
$dn = array(
"countryName" => "BR",
@@ -21,14 +23,15 @@ $args = array(
"digest_alg" => "sha1",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true
+ "encrypt_key" => true,
+ "config" => $config
);
-$privkey = openssl_pkey_new();
+$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $args));
-var_dump(openssl_csr_sign($csr, null, $privkey, 365));
-var_dump(openssl_csr_sign($csr, $cert, $priv, 365));
+var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
+var_dump(openssl_csr_sign($csr, $cert, $priv, 365, $config_arg));
var_dump(openssl_csr_sign($csr, $wrong, $privkey, 365));
var_dump(openssl_csr_sign($csr, null, $wrong, 365));
var_dump(openssl_csr_sign($csr, null, $privkey, $wrong));
@@ -38,7 +41,7 @@ var_dump(openssl_csr_sign(array(), null, $privkey, 365));
var_dump(openssl_csr_sign($csr, array(), $privkey, 365));
var_dump(openssl_csr_sign($csr, null, array(), 365));
var_dump(openssl_csr_sign($csr, null, $privkey, array()));
-var_dump(openssl_csr_sign($csr, null, $privkey, 365, array()));
+var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
diff --git a/ext/standard/tests/file/popen_pclose_basic-win32.phpt b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
index 8c2ba4252d..b5c72560d8 100644
--- a/ext/standard/tests/file/popen_pclose_basic-win32.phpt
+++ b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
@@ -28,7 +28,18 @@ pclose($file_handle);
echo "*** Testing popen(): writing to the pipe ***\n";
$arr = array("ggg", "ddd", "aaa", "sss");
-$file_handle = popen("sort", "w");
+// popen("sort", "w") fails if variables_order="GPCS"
+// this is set in the default INI file
+// it doesn't seem to be changeable in the --INI-- section
+// also, doing: ini_set('variables_order', ''); doesn't work!
+//
+// the only solution is to either put the absolute path here, or
+// remove variables_order= from PHP.ini (setting it in run-test's
+// default INI will fail too)
+//
+// since we can't depend on PHP.ini being set a certain way,
+// have to put the absolute path here.
+$file_handle = popen("/windows/system32/sort", "w");
$newline = "\n";
foreach($arr as $str) {
fwrite($file_handle, (binary)$str);
diff --git a/run-tests.php b/run-tests.php
index 3804870606..cc193e56bc 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -200,25 +200,7 @@ if (getenv('TEST_PHP_DETAILED')) {
$DETAILED = 0;
}
-// Check whether a junit log is wanted.
-$JUNIT = getenv('TEST_PHP_JUNIT');
-if (empty($JUNIT) || (!file_exists($JUNIT) && !is_writable(dirname($JUNIT))) || (file_exists($JUNIT) && !is_writable($JUNIT)) || !($JUNIT = @fopen($JUNIT, 'w'))) {
- $JUNIT = FALSE;
-}
-else{
- $JUNIT = array(
- 'fp' => $JUNIT,
- 'test_total' => 0,
- 'test_pass' => 0,
- 'test_fail' => 0,
- 'test_error' => 0,
- 'test_skip' => 0,
- 'started_at' => microtime(true),
- 'finished_at' => NULL,
- 'execution_time'=> NULL,
- 'result_xml' => '',
- );
-}
+junit_init();
if (getenv('SHOW_ONLY_GROUPS')) {
$SHOW_ONLY_GROUPS = explode(",", getenv('SHOW_ONLY_GROUPS'));
@@ -336,7 +318,7 @@ define('QA_REPORTS_PAGE', 'http://qa.php.net/reports');
function save_or_mail_results()
{
global $sum_results, $just_save_results, $failed_test_summary,
- $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression;
+ $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression;
/* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
if (!getenv('NO_INTERACTION')) {
@@ -831,10 +813,8 @@ HELP;
if ($output_file != '' && $just_save_results) {
save_or_mail_results();
}
-
- if ($JUNIT) {
- save_junit_xml();
- }
+
+ junit_save_xml();
if (getenv('REPORT_EXIT_STATUS') == 1 and preg_match('/FAILED(?: |$)/', implode(' ', $test_results))) {
exit(1);
@@ -970,9 +950,7 @@ if ($html_output) {
save_or_mail_results();
-if ($JUNIT) {
- save_junit_xml();
-}
+junit_save_xml();
if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) {
exit(1);
@@ -987,19 +965,19 @@ function mail_qa_team($data, $compression, $status = false)
{
$url_bits = parse_url(QA_SUBMISSION_PAGE);
- if (($proxy = getenv('http_proxy'))) {
- $proxy = parse_url($proxy);
- $path = $url_bits['host'].$url_bits['path'];
- $host = $proxy['host'];
- if (empty($proxy['port'])) {
- $proxy['port'] = 80;
- }
- $port = $proxy['port'];
- } else {
- $path = $url_bits['path'];
- $host = $url_bits['host'];
- $port = empty($url_bits['port']) ? 80 : $port = $url_bits['port'];
- }
+ if (($proxy = getenv('http_proxy'))) {
+ $proxy = parse_url($proxy);
+ $path = $url_bits['host'].$url_bits['path'];
+ $host = $proxy['host'];
+ if (empty($proxy['port'])) {
+ $proxy['port'] = 80;
+ }
+ $port = $proxy['port'];
+ } else {
+ $path = $url_bits['path'];
+ $host = $url_bits['host'];
+ $port = empty($url_bits['port']) ? 80 : $port = $url_bits['port'];
+ }
$data = "php_test_data=" . urlencode(base64_encode(str_replace("\00", '[0x0]', $data)));
$data_length = strlen($data);
@@ -1329,14 +1307,8 @@ TEST $file
'diff' => '',
'info' => "$bork_info [$file]",
);
-
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_error']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested_file, ENT_QUOTES).'" time="0">'."\n";
- $JUNIT['result_xml'] .= '<error type="BORKED" message="'.$bork_info.'" />'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+
+ junit_mark_test_as('BORK', $shortname, $tested_file, 0, $bork_info);
return 'BORKED';
}
@@ -1362,13 +1334,8 @@ TEST $file
$php = realpath(dirname($php) . "/php-cgi") . ' -C ';
} else {
show_result('SKIP', $tested, $tested_file, "reason: CGI not available");
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_skip']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="0">'."\n";
- $JUNIT['result_xml'] .= '<skipped>CGI not available</skipped>'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+
+ junit_mark_test_as('SKIP', $shortname, $tested, 0, 'CGI not available');
return 'SKIPPED';
}
}
@@ -1518,14 +1485,11 @@ TEST $file
$env['USE_ZEND_ALLOC'] = '1';
}
- if ($JUNIT) {
- $test_started_at = microtime(true);
- }
+ junit_start_timer($shortname);
+
$output = system_with_timeout("$extra $php $pass_options -q $ini_settings -d display_errors=0 \"$test_skipif\"", $env);
- if ($JUNIT) {
- $test_finished_at = microtime(true);
- $test_execution_time= number_format($test_finished_at-$test_started_at, 2);
- }
+
+ junit_finish_timer($shortname);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
@@ -1547,13 +1511,8 @@ TEST $file
@unlink($test_skipif);
}
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_skip']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '<skipped><![CDATA['."\n".$m[1]."\n".']]></skipped>'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+ $message = !empty($m[1]) ? $m[1] : '';
+ junit_mark_test_as('SKIP', $shortname, $tested, null, "<![CDATA[\n$message\n]]>");
return 'SKIPPED';
}
@@ -1608,12 +1567,8 @@ TEST $file
// a redirected test never fails
$IN_REDIRECT = false;
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_pass']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+
+ junit_mark_test_as('PASS', $shortname, $tested);
return 'REDIR';
} else {
@@ -1645,13 +1600,9 @@ TEST $file
'diff' => '',
'info' => "$bork_info [$file]",
);
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_error']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '<error type="BORKED" message="'.$bork_info.'" />'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+
+ junit_mark_test_as('BORK', $shortname, $tested, null, $bork_info);
+
return 'BORKED';
}
@@ -1705,13 +1656,7 @@ TEST $file
$env['REQUEST_METHOD'] = 'POST';
if (empty($request)) {
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_error']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '<error type="BORKED" message="empty $request" />'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+ junit_mark_test_as('BORK', $shortname, $tested, null, 'empty $request');
return 'BORKED';
}
@@ -1745,13 +1690,7 @@ TEST $file
$env['REQUEST_METHOD'] = 'PUT';
if (empty($request)) {
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_error']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '<error type="BORKED" message="empty $request" />'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+ junit_mark_test_as('BORK', $shortname, $tested, null, 'empty $request');
return 'BORKED';
}
@@ -1814,14 +1753,11 @@ HTTP_COOKIE = " . $env['HTTP_COOKIE'] . "
COMMAND $cmd
";
- if ($JUNIT) {
- $test_started_at = microtime(true);
- }
+ junit_start_timer($shortname);
+
$out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null);
- if ($JUNIT) {
- $test_finished_at = microtime(true);
- $test_execution_time= number_format($test_finished_at-$test_started_at, 2);
- }
+
+ junit_finish_timer($shortname);
if (array_key_exists('CLEAN', $section_text) && (!$no_clean || $cfg['keep']['clean'])) {
@@ -2010,12 +1946,7 @@ COMMAND $cmd
$info = " (warn: XFAIL section but test passes)";
}else {
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_pass']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+ junit_mark_test_as('PASS', $shortname, $tested);
return 'PASSED';
}
}
@@ -2045,12 +1976,7 @@ COMMAND $cmd
$info = " (warn: XFAIL section but test passes)";
}else {
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
- if ($JUNIT) {
- $JUNIT['test_total']++;
- $JUNIT['test_pass']++;
- $JUNIT['result_xml'] .= '<testcase classname="'.$shortname.'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+ junit_mark_test_as('PASS', $shortname, $tested);
return 'PASSED';
}
}
@@ -2146,23 +2072,8 @@ $output
if (isset($old_php)) {
$php = $old_php;
}
-
- if ($JUNIT) {
- $JUNIT['result_xml'] .= '<testcase classname="'. str_replace($cwd . '/', '', $tested_file).'" name="'.htmlspecialchars($tested, ENT_QUOTES).'" time="'.$test_execution_time.'">'."\n";
- $JUNIT['test_total']++;
- if (in_array('XFAIL', $restype)) {
- $JUNIT['test_pass']++;
- }
- elseif (in_array('FAIL', $restype)) {
- $JUNIT['test_fail']++;
- $JUNIT['result_xml'] .= '<failure type="'.$restype[0].'ED" message="'.$info.'"><![CDATA['."\n".preg_replace('/\e/', '<esc>', $diff)."\n".']]></failure>'."\n";
- }
- else{
- $JUNIT['test_error']++;
- $JUNIT['result_xml'] .= '<error type="'.$restype[0].'ED" message="'.$info.'"><![CDATA['."\n".preg_replace('/\e/', '<esc>', $diff)."\n".']]></error>'."\n";
- }
- $JUNIT['result_xml'] .= '</testcase>'."\n";
- }
+
+ junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, "<![CDATA[\n " . preg_replace('/\e/', '<esc>', $diff) . "\n]]>");
return $restype[0] . 'ED';
}
@@ -2650,19 +2561,201 @@ function show_result($result, $tested, $tested_file, $extra = '', $temp_filename
}
}
-function save_junit_xml() {
+function junit_init() {
+ // Check whether a junit log is wanted.
+ $JUNIT = getenv('TEST_PHP_JUNIT');
+ if (empty($JUNIT)) {
+ $JUNIT = FALSE;
+ } elseif (!$fp = fopen($JUNIT, 'w')) {
+ error("Failed to open $JUNIT for writing.");
+ } else {
+ $JUNIT = array(
+ 'fp' => $fp,
+ 'name' => 'php-src',
+ 'test_total' => 0,
+ 'test_pass' => 0,
+ 'test_fail' => 0,
+ 'test_error' => 0,
+ 'test_skip' => 0,
+ 'execution_time'=> 0,
+ 'suites' => array(),
+ 'files' => array()
+ );
+ }
+
+ $GLOBALS['JUNIT'] = $JUNIT;
+}
+
+function junit_save_xml() {
global $JUNIT;
- $JUNIT['finished_at'] = microtime(true);
- $JUNIT['execution_time']= number_format(($JUNIT['finished_at']-$JUNIT['started_at']), 2);
- $JUNIT['result_xml'] = '<?xml version="1.0" encoding="UTF-8"?>'."\n".
- '<testsuites>'."\n".
- '<testsuite name="php-src" tests="'.$JUNIT['test_total'].'" failures="'.$JUNIT['test_fail'].'" errors="'.$JUNIT['test_error'].'" skip="'.$JUNIT['test_skip'].'" time="'.$JUNIT['execution_time'].'">'."\n".
- $JUNIT['result_xml'].
- '</testsuite>'."\n".
- '</testsuites>';
- fwrite($JUNIT['fp'], $JUNIT['result_xml']);
+ if (!junit_enabled()) return;
+
+ $xml = '<?xml version="1.0" encoding="UTF-8"?>'. PHP_EOL .
+ '<testsuites>' . PHP_EOL;
+ $xml .= junit_get_suite_xml();
+ $xml .= '</testsuites>';
+ fwrite($JUNIT['fp'], $xml);
}
+function junit_get_suite_xml($suite_name = '') {
+ global $JUNIT;
+
+ $suite = $suite_name ? $JUNIT['suites'][$suite_name] : $JUNIT;
+
+ $result = sprintf(
+ '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s">' . PHP_EOL,
+ $suite['name'], $suite['test_total'], $suite['test_fail'], $suite['test_error'], $suite['test_skip'],
+ $suite['execution_time']
+ );
+
+ foreach($suite['suites'] as $sub_suite) {
+ $result .= junit_get_suite_xml($sub_suite['name']);
+ }
+
+ // Output files only in subsuites
+ if (!empty($suite_name)) {
+ foreach($suite['files'] as $file) {
+ $result .= $JUNIT['files'][$file]['xml'];
+ }
+ }
+
+ $result .= '</testsuite>' . PHP_EOL;
+
+ return $result;
+}
+
+function junit_enabled() {
+ global $JUNIT;
+ return !empty($JUNIT);
+}
+
+/**
+ * @param array|string $type
+ * @param string $file_name
+ * @param string $test_name
+ * @param int|string $time
+ * @param string $message
+ * @param string $details
+ * @return void
+ */
+function junit_mark_test_as($type, $file_name, $test_name, $time = null, $message = '', $details = '') {
+ global $JUNIT;
+ if (!junit_enabled()) return;
+
+ $suite = junit_get_suitename_for($file_name);
+
+ junit_suite_record($suite, 'test_total');
+
+ $time = null !== $time ? $time : junit_get_timer($file_name);
+ junit_suite_record($suite, 'execution_time', $time);
+
+ $escaped_test_name = basename($file_name) . ' - ' . htmlspecialchars($test_name, ENT_QUOTES);
+ $JUNIT['files'][$file_name]['xml'] = "<testcase classname='$suite' name='$escaped_test_name' time='$time'>\n";
+
+ if (is_array($type)) {
+ $output_type = $type[0] . 'ED';
+ $type = reset(array_intersect(array('XFAIL', 'FAIL'), $type));
+ } else {
+ $output_type = $type . 'ED';
+ }
+
+ if ('PASS' == $type || 'XFAIL' == $type) {
+ junit_suite_record($suite, 'test_pass');
+ } elseif ('BORK' == $type) {
+ junit_suite_record($suite, 'test_error');
+ $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$message'/>\n";
+ } elseif ('SKIP' == $type) {
+ junit_suite_record($suite, 'test_skip');
+ $JUNIT['files'][$file_name]['xml'] .= "<skipped>$message</skipped>\n";
+ } elseif('FAIL' == $type) {
+ junit_suite_record($suite, 'test_fail');
+ $JUNIT['files'][$file_name]['xml'] .= "<failure type='$output_type' message='$message'>$details</failure>\n";
+ } else {
+ junit_suite_record($suite, 'test_error');
+ $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$message'>$details</error>\n";
+ }
+
+ $JUNIT['files'][$file_name]['xml'] .= "</testcase>\n";
+
+}
+
+function junit_suite_record($suite, $param, $value = 1) {
+ global $JUNIT;
+
+ $JUNIT[$param] += $value;
+ $JUNIT['suites'][$suite][$param] += $value;
+}
+
+function junit_get_timer($file_name) {
+ global $JUNIT;
+ if (!junit_enabled()) return 0;
+
+ if (isset($JUNIT['files'][$file_name]['total'])) {
+ return number_format($JUNIT['files'][$file_name]['total'], 4);
+ }
+
+ return 0;
+}
+
+function junit_start_timer($file_name) {
+ global $JUNIT;
+ if (!junit_enabled()) return;
+
+ if (!isset($JUNIT['files'][$file_name]['start'])) {
+ $JUNIT['files'][$file_name]['start'] = microtime(true);
+
+ $suite = junit_get_suitename_for($file_name);
+ junit_init_suite($suite);
+ $JUNIT['suites'][$suite]['files'][$file_name] = $file_name;
+ }
+}
+
+function junit_get_suitename_for($file_name) {
+ return junit_path_to_classname(dirname($file_name));
+}
+
+function junit_path_to_classname($file_name) {
+ global $JUNIT;
+ return $JUNIT['name'] . '.' . str_replace(DIRECTORY_SEPARATOR, '.', $file_name);
+}
+
+function junit_init_suite($suite_name) {
+ global $JUNIT;
+ if (!junit_enabled()) return;
+
+ if (!empty($JUNIT['suites'][$suite_name])) {
+ return;
+ }
+
+ $JUNIT['suites'][$suite_name] = array(
+ 'name' => $suite_name,
+ 'test_total' => 0,
+ 'test_pass' => 0,
+ 'test_fail' => 0,
+ 'test_error' => 0,
+ 'test_skip' => 0,
+ 'suites' => array(),
+ 'files' => array(),
+ 'execution_time'=> 0,
+ );
+}
+
+function junit_finish_timer($file_name) {
+ global $JUNIT;
+ if (!junit_enabled()) return;
+
+ if (!isset($JUNIT['files'][$file_name]['start'])) {
+ error("Timer for $file_name was not started!");
+ }
+
+ if (!isset($JUNIT['files'][$file_name]['total'])) {
+ $JUNIT['files'][$file_name]['total'] = 0;
+ }
+
+ $start = $JUNIT['files'][$file_name]['start'];
+ $JUNIT['files'][$file_name]['total'] += microtime(true) - $start;
+ unset($JUNIT['files'][$file_name]['start']);
+}
/*
* Local variables: