summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl')
-rwxr-xr-xext/intl/collator/collator_compare.c8
-rwxr-xr-xext/intl/collator/collator_locale.c9
-rwxr-xr-xext/intl/collator/collator_sort.c23
-rwxr-xr-xext/intl/formatter/formatter_attr.c6
-rwxr-xr-xext/intl/locale/locale_methods.c22
-rw-r--r--ext/intl/tests/bug60192-compare.phpt19
-rw-r--r--ext/intl/tests/bug60192-getlocale.phpt20
-rw-r--r--ext/intl/tests/bug60192-getsortkey.phpt20
-rw-r--r--ext/intl/tests/bug60192-sort.phpt21
-rw-r--r--ext/intl/tests/bug60192-sortwithsortkeys.phpt21
-rwxr-xr-xext/intl/tests/dateformat_parse.phpt99
-rwxr-xr-xext/intl/tests/dateformat_parse_timestamp_parsepos.phpt119
-rwxr-xr-xext/intl/tests/locale_get_display_region.phpt12
-rwxr-xr-xext/intl/tests/locale_get_region.phpt12
-rwxr-xr-xext/intl/tests/locale_parse_locale.phpt143
-rw-r--r--ext/intl/tests/resourcebundle_arrayaccess.phpt2
-rw-r--r--ext/intl/tests/resourcebundle_individual.phpt2
-rw-r--r--ext/intl/tests/resourcebundle_iterator.phpt2
18 files changed, 387 insertions, 173 deletions
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index 840855661..4384558ac 100755
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -58,6 +58,14 @@ PHP_FUNCTION( collator_compare )
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+ intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+ "Object not initialized", 0 TSRMLS_CC );
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
+
+ RETURN_FALSE;
+ }
/*
* Compare given strings (converting them to UTF-16 first).
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index 331fed22f..b30b021ee 100755
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
@@ -51,6 +51,15 @@ PHP_FUNCTION( collator_get_locale )
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+ intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+ "Object not initialized", 0 TSRMLS_CC );
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
+
+ RETURN_FALSE;
+ }
+
/* Get locale by specified type. */
locale_name = (char*) ucol_getLocaleByType(
co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index 929a9c09d..a871c90a8 100755
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -73,6 +73,13 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2
/* Fetch collator object. */
co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );
+ if (!co || !co->ucoll) {
+ intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+ intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+ "Object not initialized", 0 TSRMLS_CC );
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
+ }
+
/* Compare the strings using ICU. */
result->value.lval = ucol_strcoll(
co->ucoll,
@@ -387,6 +394,14 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+ intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+ "Object not initialized", 0 TSRMLS_CC );
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
+
+ RETURN_FALSE;
+ }
/*
* Sort specified array.
@@ -551,6 +566,14 @@ PHP_FUNCTION( collator_get_sort_key )
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+ intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+ "Object not initialized", 0 TSRMLS_CC );
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
+
+ RETURN_FALSE;
+ }
/*
* Compare given strings (converting them to UTF-16 first).
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index b306bbede..448a9db72 100755
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -77,11 +77,11 @@ PHP_FUNCTION( numfmt_get_attribute )
break;
case UNUM_ROUNDING_INCREMENT:
{
- double value = unum_getDoubleAttribute(FORMATTER_OBJECT(nfo), attribute);
- if(value == -1) {
+ double value_double = unum_getDoubleAttribute(FORMATTER_OBJECT(nfo), attribute);
+ if(value_double == -1) {
INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
} else {
- RETVAL_DOUBLE(value);
+ RETVAL_DOUBLE(value_double);
}
}
break;
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index bbfb65bbd..593b6e472 100755
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: locale_methods.c 307392 2011-01-12 00:29:59Z felipe $ */
+/* $Id: locale_methods.c 319676 2011-11-22 12:29:15Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -470,6 +470,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
char* disp_loc_name = NULL;
int disp_loc_name_len = 0;
+ int free_loc_name = 0;
UChar* disp_name = NULL;
int32_t disp_name_len = 0;
@@ -517,17 +518,18 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
if( mod_loc_name==NULL ){
mod_loc_name = estrdup( loc_name );
}
+
+ /* Check if disp_loc_name passed , if not use default locale */
+ if( !disp_loc_name){
+ disp_loc_name = estrdup(INTL_G(default_locale));
+ free_loc_name = 1;
+ }
/* Get the disp_value for the given locale */
do{
disp_name = erealloc( disp_name , buflen );
disp_name_len = buflen;
- /* Check if disp_loc_name passed , if not use default locale */
- if( !disp_loc_name){
- disp_loc_name = estrdup(INTL_G(default_locale));
- }
-
if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
buflen = uloc_getDisplayLanguage ( mod_loc_name , disp_loc_name , disp_name , disp_name_len , &status);
} else if( strcmp(tag_name , LOC_SCRIPT_TAG)==0 ){
@@ -557,6 +559,10 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
if( mod_loc_name){
efree( mod_loc_name );
}
+ if (free_loc_name) {
+ efree(disp_loc_name);
+ disp_loc_name = NULL;
+ }
RETURN_FALSE;
}
} while( buflen > disp_name_len );
@@ -564,6 +570,10 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
if( mod_loc_name){
efree( mod_loc_name );
}
+ if (free_loc_name) {
+ efree(disp_loc_name);
+ disp_loc_name = NULL;
+ }
/* Convert display locale name from UTF-16 to UTF-8. */
intl_convert_utf16_to_utf8( &utf8value, &utf8value_len, disp_name, buflen, &status );
efree( disp_name );
diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt
new file mode 100644
index 000000000..0fd24cce8
--- /dev/null
+++ b/ext/intl/tests/bug60192-compare.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = $c->compare('h', 'H');
+--EXPECTF--
+
+Catchable fatal error: Collator::compare(): Object not initialized in %s on line %d
diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt
new file mode 100644
index 000000000..50e3ec35e
--- /dev/null
+++ b/ext/intl/tests/bug60192-getlocale.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getLocale(Locale::ACTUAL_LOCALE);
+--EXPECTF--
+
+Catchable fatal error: Collator::getLocale(): Object not initialized in %s on line %d
diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt
new file mode 100644
index 000000000..39755ae8f
--- /dev/null
+++ b/ext/intl/tests/bug60192-getsortkey.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getSortKey('h');
+--EXPECTF--
+
+Catchable fatal error: Collator::getSortKey(): Object not initialized in %s on line %d
diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt
new file mode 100644
index 000000000..57057215e
--- /dev/null
+++ b/ext/intl/tests/bug60192-sort.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sort($a);
+--EXPECTF--
+
+Catchable fatal error: Collator::sort(): Object not initialized in %s on line %d
diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
new file mode 100644
index 000000000..445f4a03b
--- /dev/null
+++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sortWithSortKeys($a);
+--EXPECTF--
+
+Catchable fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d
diff --git a/ext/intl/tests/dateformat_parse.phpt b/ext/intl/tests/dateformat_parse.phpt
index b3be895e5..ce800aa48 100755
--- a/ext/intl/tests/dateformat_parse.phpt
+++ b/ext/intl/tests/dateformat_parse.phpt
@@ -2,6 +2,8 @@
datefmt_parse_code()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--INI--
+date.timezone="America/Los_Angeles"
--FILE--
<?php
@@ -9,13 +11,14 @@ datefmt_parse_code()
* Test for the datefmt_parse function
*/
+putenv('TZ=America/Los_Angeles');
function ut_main()
{
$locale_arr = array (
'en_US_CA'
);
-
+
$datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
@@ -28,36 +31,34 @@ function ut_main()
$text_arr = array (
- "Sunday, September 18, 2039 4:06:40 PM PT",
- "Wednesday, December 17, 1969 6:40:00 PM PT",
- "Thursday, December 18, 1969 8:49:59 AM PST",
- "Thursday, December 18, 1969 8:49:59 PM PST",
- "December 18, 1969 8:49:59 AM PST",
- "12/18/69 8:49 AM",
- "19691218 08:49 AM"
+ // Full parsing
+ array("Sunday, September 18, 2039 4:06:40 PM PT", IntlDateFormatter::FULL, IntlDateFormatter::FULL),
+ array("Wednesday, December 17, 1969 6:40:00 PM PT", IntlDateFormatter::FULL, IntlDateFormatter::FULL),
+ array("Thursday, December 18, 1969 8:49:59 PM PST", IntlDateFormatter::FULL, IntlDateFormatter::FULL),
+ array("December 18, 1969 8:49:59 AM PST", IntlDateFormatter::LONG, IntlDateFormatter::FULL),
+ array("12/18/69 8:49 AM", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT),
+ array("19691218 08:49 AM", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT),
+ // Partial parsing
+ array("Sunday, September 18, 2039 4:06:40 PM PT", IntlDateFormatter::FULL, IntlDateFormatter::NONE),
+ array("Sunday, September 18, 2039 4:06:40 PM PT", IntlDateFormatter::FULL, IntlDateFormatter::SHORT),
+ array("December 18, 1969 8:49:59 AM PST", IntlDateFormatter::LONG, IntlDateFormatter::NONE),
+ array("December 18, 1969 8:49:59 AM PST", IntlDateFormatter::LONG, IntlDateFormatter::SHORT),
+ array("12/18/69 8:49 AM", IntlDateFormatter::SHORT, IntlDateFormatter::LONG),
+ array("19691218 08:49 AM", IntlDateFormatter::SHORT, IntlDateFormatter::LONG),
);
- $parse_pos = 0;
- $fmt = ut_datefmt_create( 'en_US_CA', IntlDateFormatter::NONE, IntlDateFormatter::SHORT);
foreach( $text_arr as $text_entry){
- for ( $parse_pos = 0 ; $parse_pos< strlen($text_entry) ; $parse_pos++ ){
- $i = $parse_pos;
- $parsed = ut_datefmt_parse( $fmt , $text_entry , $parse_pos );
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nInput text :$text_entry ; Parsed text : $parsed";
- $res_str .= " ; parse_pos : $i $parse_pos";
- } else {
- $parse_pos = $i;
- }
-/*
- else{
- $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
- }
-*/
+ $fmt = ut_datefmt_create( 'en_US_CA', $text_entry[1], $text_entry[2]);
+ $parse_pos = 0;
+ $parsed = ut_datefmt_parse( $fmt , $text_entry[0] , $parse_pos );
+
+ $res_str .= "\nInput text : {$text_entry[0]} ; DF = {$text_entry[1]}; TF = {$text_entry[2]}";
+ if( intl_get_error_code() != U_ZERO_ERROR) {
+ $res_str .= "\nError : ".intl_get_error_message();
}
+ $res_str .= "\nParsed: $parsed; parse_pos : $parse_pos\n";
}
-
return $res_str;
}
@@ -68,10 +69,44 @@ include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
-Input text :Sunday, September 18, 2039 4:06:40 PM PT ; Parsed text : 96000 ; parse_pos : 29 37
-Input text :Wednesday, December 17, 1969 6:40:00 PM PT ; Parsed text : 216000 ; parse_pos : 31 39
-Input text :Thursday, December 18, 1969 8:49:59 AM PST ; Parsed text : 208740 ; parse_pos : 30 38
-Input text :Thursday, December 18, 1969 8:49:59 PM PST ; Parsed text : 251940 ; parse_pos : 30 38
-Input text :December 18, 1969 8:49:59 AM PST ; Parsed text : 208740 ; parse_pos : 20 28
-Input text :12/18/69 8:49 AM ; Parsed text : 60540 ; parse_pos : 8 16
-Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 8 17
+
+Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 0
+Parsed: 2200000000; parse_pos : 40
+
+Input text : Wednesday, December 17, 1969 6:40:00 PM PT ; DF = 0; TF = 0
+Parsed: -1200000; parse_pos : 42
+
+Input text : Thursday, December 18, 1969 8:49:59 PM PST ; DF = 0; TF = 0
+Parsed: -1105801; parse_pos : 42
+
+Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 0
+Parsed: -1149001; parse_pos : 32
+
+Input text : 12/18/69 8:49 AM ; DF = 3; TF = 3
+Parsed: -1149060; parse_pos : 16
+
+Input text : 19691218 08:49 AM ; DF = 3; TF = 3
+Error : Date parsing failed: U_PARSE_ERROR
+Parsed: ; parse_pos : 8
+
+Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = -1
+Parsed: 2199942000; parse_pos : 26
+
+Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 3
+Error : Date parsing failed: U_PARSE_ERROR
+Parsed: ; parse_pos : 31
+
+Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = -1
+Parsed: -1180800; parse_pos : 17
+
+Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 3
+Error : Date parsing failed: U_PARSE_ERROR
+Parsed: ; parse_pos : 22
+
+Input text : 12/18/69 8:49 AM ; DF = 3; TF = 1
+Error : Date parsing failed: U_PARSE_ERROR
+Parsed: ; parse_pos : 13
+
+Input text : 19691218 08:49 AM ; DF = 3; TF = 1
+Error : Date parsing failed: U_PARSE_ERROR
+Parsed: ; parse_pos : 8
diff --git a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
index b7e820388..040f72e47 100755
--- a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
+++ b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
@@ -2,6 +2,10 @@
datefmt_parse_timestamp_code() with parse pos
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--INI--
+datetime.timezone="America/Los_Angeles"
+--ENV--
+TZ=America/Los_Angeles
--FILE--
<?php
@@ -15,7 +19,7 @@ function ut_main()
$locale_arr = array (
'en_US_CA'
);
-
+
$datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
@@ -31,8 +35,8 @@ function ut_main()
"Sunday, September 18, 3039 4:06:40 PM PT",
"Thursday, December 18, 1969 8:49:59 AM PST",
//"December 18, 1969 8:49:59 AM PST",
- //"12/18/69 8:49 AM",
- "19001218 08:49 AM",
+ "12/18/69 8:49 AM",
+ "20111218 08:49 AM",
"19691218 08:49 AM"
);
@@ -46,18 +50,19 @@ function ut_main()
$res_str .= "\n------------";
foreach( $datetype_arr as $datetype_entry )
{
- $res_str .= "\ndatetype = $datetype_entry ,timetype =$datetype_entry ";
+ $res_str .= "\ndatetype = $datetype_entry ,timetype =$datetype_entry";
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry);
- $parsed = ut_datefmt_parse( $fmt , $text_entry);
+ $pos = 0;
+ $parsed = ut_datefmt_parse( $fmt , $text_entry, $pos);
if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nParsed text is : $parsed";
+ $res_str .= "\nParsed text is : $parsed; Position = $pos";
}else{
- $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
+ $res_str .= "\nError while parsing as: '".intl_get_error_message()."'; Position = $pos";
}
}
}
}
-
+ $res_str .= "\n";
return $res_str;
@@ -75,61 +80,77 @@ Input text is : Sunday, September 18, 3039 4:06:40 PM PT
------------
Locale is : en_US_CA
------------
-datetype = 0 ,timetype =0
-Parsed text is : 33756908800
-datetype = 1 ,timetype =1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 2 ,timetype =2
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 3 ,timetype =3
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = -1 ,timetype =-1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
+datetype = 0 ,timetype =0
+Parsed text is : 33756908800; Position = 40
+datetype = 1 ,timetype =1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 2 ,timetype =2
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 3 ,timetype =3
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = -1 ,timetype =-1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------
Input text is : Thursday, December 18, 1969 8:49:59 AM PST
------------
Locale is : en_US_CA
------------
-datetype = 0 ,timetype =0
-Parsed text is : -1149001
-datetype = 1 ,timetype =1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 2 ,timetype =2
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 3 ,timetype =3
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = -1 ,timetype =-1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
+datetype = 0 ,timetype =0
+Parsed text is : -1149001; Position = 42
+datetype = 1 ,timetype =1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 2 ,timetype =2
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 3 ,timetype =3
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = -1 ,timetype =-1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+------------
+
+Input text is : 12/18/69 8:49 AM
+------------
+Locale is : en_US_CA
+------------
+datetype = 0 ,timetype =0
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 1 ,timetype =1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 2 ,timetype =2
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 3 ,timetype =3
+Parsed text is : -1149060; Position = 16
+datetype = -1 ,timetype =-1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------
-Input text is : 19001218 08:49 AM
+Input text is : 20111218 08:49 AM
------------
Locale is : en_US_CA
------------
-datetype = 0 ,timetype =0
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 1 ,timetype =1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 2 ,timetype =2
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 3 ,timetype =3
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = -1 ,timetype =-1
-Parsed text is : -2178601860
+datetype = 0 ,timetype =0
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 1 ,timetype =1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 2 ,timetype =2
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 3 ,timetype =3
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
+datetype = -1 ,timetype =-1
+Parsed text is : 1324226940; Position = 17
------------
Input text is : 19691218 08:49 AM
------------
Locale is : en_US_CA
------------
-datetype = 0 ,timetype =0
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 1 ,timetype =1
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 2 ,timetype =2
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = 3 ,timetype =3
-Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'
-datetype = -1 ,timetype =-1
-Parsed text is : -1149060
+datetype = 0 ,timetype =0
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 1 ,timetype =1
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 2 ,timetype =2
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
+datetype = 3 ,timetype =3
+Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
+datetype = -1 ,timetype =-1
+Parsed text is : -1149060; Position = 17
diff --git a/ext/intl/tests/locale_get_display_region.phpt b/ext/intl/tests/locale_get_display_region.phpt
index 354fc0623..48cd7b6c7 100755
--- a/ext/intl/tests/locale_get_display_region.phpt
+++ b/ext/intl/tests/locale_get_display_region.phpt
@@ -163,14 +163,14 @@ 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=
-disp_locale=fr : display_region=
-disp_locale=de : display_region=
+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=
-disp_locale=fr : display_region=
-disp_locale=de : display_region=
+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
diff --git a/ext/intl/tests/locale_get_region.phpt b/ext/intl/tests/locale_get_region.phpt
index 0bebb331a..0baae4993 100755
--- a/ext/intl/tests/locale_get_region.phpt
+++ b/ext/intl/tests/locale_get_region.phpt
@@ -84,7 +84,7 @@ include_once( 'ut_common.inc' );
ut_run();
?>
---EXPECT--
+--EXPECTF--
uk-ua_CALIFORNIA@currency=;currency=GRN: region='UA'
root: region=''
uk@currency=EURO: region=''
@@ -99,8 +99,8 @@ sr-Cyrl: region=''
sr-Latn: region=''
zh-Hans-CN: region='CN'
sr-Latn-CS: region='CS'
-sl-rozaj: region=''
-sl-nedis: region=''
+sl-rozaj: region='%r(ROZAJ)?%r'
+sl-nedis: region='%r(NEDIS)?%r'
de-CH-1901: region='CH'
sl-IT-nedis: region='IT'
sl-Latn-IT-nedis: region='IT'
@@ -108,7 +108,7 @@ de-DE: region='DE'
en-US: region='US'
es-419: region='419'
de-CH-x-phonebk: region='CH'
-az-Arab-x-AZE-derbend: region=''
+az-Arab-x-AZE-derbend: region='%r(X)?%r'
zh-min: region=''
zh-min-nan-Hant-CN: region='MIN'
x-whatever: region=''
@@ -117,7 +117,7 @@ sr-Latn-QM: region='QM'
sr-Qaaa-CS: region='CS'
en-US-u-islamCal: region='US'
zh-CN-a-myExt-x-private: region='CN'
-en-a-myExt-b-another: region=''
+en-a-myExt-b-another: region='%r(A)?%r'
de-419-DE: region='419'
a-DE: region='DE'
-ar-a-aaa-b-bbb-a-ccc: region=''
+ar-a-aaa-b-bbb-a-ccc: region='%r(A)?%r'
diff --git a/ext/intl/tests/locale_parse_locale.phpt b/ext/intl/tests/locale_parse_locale.phpt
index e47f71830..36637f0d8 100755
--- a/ext/intl/tests/locale_parse_locale.phpt
+++ b/ext/intl/tests/locale_parse_locale.phpt
@@ -6,7 +6,7 @@ locale_parse_locale()
<?php
/*
- * Try parsing different Locales
+ * Try parsing different Locales
* with Procedural and Object methods.
*/
@@ -72,11 +72,12 @@ function ut_main()
{
$arr = ut_loc_locale_parse( $locale);
$res_str .= "---------------------\n";
- $res_str .= "$locale: \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.";
@@ -93,109 +94,109 @@ include_once( 'ut_common.inc' );
ut_run();
?>
---EXPECT--
+--EXPECTF--
---------------------
-uk-ua_CALIFORNIA@currency=;currency=GRN:
-language : 'uk' , region : 'UA' , variant0 : 'CALIFORNIA' ,
+uk-ua_CALIFORNIA@currency=;currency=GRN:
+language : 'uk' , region : 'UA' , variant0 : 'CALIFORNIA' ,
---------------------
-root:
-language : 'root' ,
+root:
+language : 'root' ,
---------------------
-uk@currency=EURO:
-language : 'uk' ,
+uk@currency=EURO:
+language : 'uk' ,
---------------------
-Hindi:
-language : 'hindi' ,
+Hindi:
+language : 'hindi' ,
---------------------
-de:
-language : 'de' ,
+de:
+language : 'de' ,
---------------------
-fr:
-language : 'fr' ,
+fr:
+language : 'fr' ,
---------------------
-ja:
-language : 'ja' ,
+ja:
+language : 'ja' ,
---------------------
-i-enochian:
-grandfathered : 'i-enochian' ,
+i-enochian:
+grandfathered : 'i-enochian' ,
---------------------
-zh-Hant:
-language : 'zh' , script : 'Hant' ,
+zh-Hant:
+language : 'zh' , script : 'Hant' ,
---------------------
-zh-Hans:
-language : 'zh' , script : 'Hans' ,
+zh-Hans:
+language : 'zh' , script : 'Hans' ,
---------------------
-sr-Cyrl:
-language : 'sr' , script : 'Cyrl' ,
+sr-Cyrl:
+language : 'sr' , script : 'Cyrl' ,
---------------------
-sr-Latn:
-language : 'sr' , script : 'Latn' ,
+sr-Latn:
+language : 'sr' , script : 'Latn' ,
---------------------
-zh-Hans-CN:
-language : 'zh' , script : 'Hans' , region : 'CN' ,
+zh-Hans-CN:
+language : 'zh' , script : 'Hans' , region : 'CN' ,
---------------------
-sr-Latn-CS:
-language : 'sr' , script : 'Latn' , region : 'CS' ,
+sr-Latn-CS:
+language : 'sr' , script : 'Latn' , region : 'CS' ,
---------------------
-sl-rozaj:
-language : 'sl' ,
+sl-rozaj:
+language : 'sl' ,%r( region : 'ROZAJ' ,)?%r
---------------------
-sl-nedis:
-language : 'sl' ,
+sl-nedis:
+language : 'sl' ,%r( region : 'NEDIS' ,)?%r
---------------------
-de-CH-1901:
-language : 'de' , region : 'CH' , variant0 : '1901' ,
+de-CH-1901:
+language : 'de' , region : 'CH' , variant0 : '1901' ,
---------------------
-sl-IT-nedis:
-language : 'sl' , region : 'IT' , variant0 : 'NEDIS' ,
+sl-IT-nedis:
+language : 'sl' , region : 'IT' , variant0 : 'NEDIS' ,
---------------------
-sl-Latn-IT-nedis:
-language : 'sl' , script : 'Latn' , region : 'IT' , variant0 : 'NEDIS' ,
+sl-Latn-IT-nedis:
+language : 'sl' , script : 'Latn' , region : 'IT' , variant0 : 'NEDIS' ,
---------------------
-de-DE:
-language : 'de' , region : 'DE' ,
+de-DE:
+language : 'de' , region : 'DE' ,
---------------------
-en-US:
-language : 'en' , region : 'US' ,
+en-US:
+language : 'en' , region : 'US' ,
---------------------
-es-419:
-language : 'es' , region : '419' ,
+es-419:
+language : 'es' , region : '419' ,
---------------------
-de-CH-x-phonebk:
-language : 'de' , region : 'CH' , private0 : 'phonebk' ,
+de-CH-x-phonebk:
+language : 'de' , region : 'CH' , private0 : 'phonebk' ,
---------------------
-az-Arab-x-AZE-derbend:
-language : 'az' , script : 'Arab' , private0 : 'AZE' , private1 : 'derbend' ,
+az-Arab-x-AZE-derbend:
+language : 'az' , script : 'Arab' , private0 : 'AZE' , private1 : 'derbend' ,
---------------------
-zh-min:
-grandfathered : 'zh-min' ,
+zh-min:
+grandfathered : 'zh-min' ,
---------------------
-zh-min-nan-Hant-CN:
-language : 'zh' , region : 'MIN' , variant0 : 'NAN' , variant1 : 'HANT' , variant2 : 'CN' ,
+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' ,
+qaa-Qaaa-QM-x-southern:
+language : 'qaa' , script : 'Qaaa' , region : 'QM' , private0 : 'southern' ,
---------------------
-sr-Latn-QM:
-language : 'sr' , script : 'Latn' , region : 'QM' ,
+sr-Latn-QM:
+language : 'sr' , script : 'Latn' , region : 'QM' ,
---------------------
-sr-Qaaa-CS:
-language : 'sr' , script : 'Qaaa' , region : 'CS' ,
+sr-Qaaa-CS:
+language : 'sr' , script : 'Qaaa' , region : 'CS' ,
---------------------
-en-US-u-islamCal:
-language : 'en' , region : 'US' ,
+en-US-u-islamCal:
+language : 'en' , region : 'US' ,
---------------------
-zh-CN-a-myExt-x-private:
-language : 'zh' , region : 'CN' , private0 : 'private' ,
+zh-CN-a-myExt-x-private:
+language : 'zh' , region : 'CN' , private0 : 'private' ,
---------------------
-en-a-myExt-b-another:
-language : 'en' ,
+en-a-myExt-b-another:
+language : 'en' ,
---------------------
-de-419-DE:
-language : 'de' , region : '419' , variant0 : 'DE' ,
+de-419-DE:
+language : 'de' , region : '419' , variant0 : 'DE' ,
---------------------
-a-DE:
+a-DE:
No values found from Locale parsing.
---------------------
-ar-a-aaa-b-bbb-a-ccc:
+ar-a-aaa-b-bbb-a-ccc:
language : 'ar' ,
diff --git a/ext/intl/tests/resourcebundle_arrayaccess.phpt b/ext/intl/tests/resourcebundle_arrayaccess.phpt
index ef2c0a8b9..d035a8d30 100644
--- a/ext/intl/tests/resourcebundle_arrayaccess.phpt
+++ b/ext/intl/tests/resourcebundle_arrayaccess.phpt
@@ -1,5 +1,7 @@
--TEST--
Test ResourceBundle array access and count - existing/missing keys
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
include "resourcebundle.inc";
diff --git a/ext/intl/tests/resourcebundle_individual.phpt b/ext/intl/tests/resourcebundle_individual.phpt
index 182cbf325..dcbf1f583 100644
--- a/ext/intl/tests/resourcebundle_individual.phpt
+++ b/ext/intl/tests/resourcebundle_individual.phpt
@@ -1,5 +1,7 @@
--TEST--
Test ResourceBundle::get() and length() - existing/missing keys
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
include "resourcebundle.inc";
diff --git a/ext/intl/tests/resourcebundle_iterator.phpt b/ext/intl/tests/resourcebundle_iterator.phpt
index 31b0768bf..a10b9deb8 100644
--- a/ext/intl/tests/resourcebundle_iterator.phpt
+++ b/ext/intl/tests/resourcebundle_iterator.phpt
@@ -1,5 +1,7 @@
--TEST--
Test ResourceBundle iterator
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
include "resourcebundle.inc";