summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl')
-rwxr-xr-xext/intl/collator/collator_class.c2
-rwxr-xr-xext/intl/collator/collator_compare.c12
-rwxr-xr-xext/intl/dateformat/dateformat_attr.c4
-rwxr-xr-xext/intl/dateformat/dateformat_class.c2
-rwxr-xr-xext/intl/formatter/formatter_attr.c12
-rwxr-xr-xext/intl/formatter/formatter_class.c2
-rwxr-xr-xext/intl/formatter/formatter_parse.c8
-rwxr-xr-xext/intl/grapheme/grapheme_string.c34
-rwxr-xr-xext/intl/grapheme/grapheme_util.c53
-rwxr-xr-xext/intl/grapheme/grapheme_util.h4
-rw-r--r--ext/intl/idn/idn.c6
-rwxr-xr-xext/intl/locale/locale_class.c4
-rwxr-xr-xext/intl/msgformat/msgformat_attr.c4
-rwxr-xr-xext/intl/msgformat/msgformat_class.c2
-rwxr-xr-xext/intl/msgformat/msgformat_parse.c4
-rwxr-xr-xext/intl/normalizer/normalizer_class.c2
-rwxr-xr-xext/intl/normalizer/normalizer_normalize.c8
-rwxr-xr-xext/intl/php_intl.c9
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c8
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.h1
-rw-r--r--ext/intl/tests/intl_icu_data_version_constant.phpt10
-rw-r--r--ext/intl/tests/intl_icu_version_constant.phpt10
-rw-r--r--ext/intl/tests/resourcebundle_create.phpt2
-rw-r--r--ext/intl/tests/resourcebundle_internal.phpt19
24 files changed, 169 insertions, 53 deletions
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 58a11fe46..38b2e978c 100755
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -127,7 +127,7 @@ function_entry Collator_class_functions[] = {
PHP_NAMED_FE( getErrorCode, ZEND_FN( collator_get_error_code ), collator_0_args )
PHP_NAMED_FE( getErrorMessage, ZEND_FN( collator_get_error_message ), collator_0_args )
PHP_NAMED_FE( getSortKey, ZEND_FN( collator_get_sort_key ), collator_2_args )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index 4e7b3a7d4..840855661 100755
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -74,7 +74,9 @@ PHP_FUNCTION( collator_compare )
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting first argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
RETURN_FALSE;
}
@@ -88,8 +90,12 @@ PHP_FUNCTION( collator_compare )
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting second argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
- efree( ustr2 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
+ if (ustr2) {
+ efree( ustr2 );
+ }
RETURN_FALSE;
}
diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c
index 7c6cef953..6131cedc9 100755
--- a/ext/intl/dateformat/dateformat_attr.c
+++ b/ext/intl/dateformat/dateformat_attr.c
@@ -276,7 +276,9 @@ PHP_FUNCTION( datefmt_set_pattern )
udat_applyPattern(DATE_FORMAT_OBJECT(dfo), (UBool)is_pattern_localized, svalue, slength);
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS(dfo, "Error setting symbol value");
RETURN_TRUE;
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index 74c193bc0..eb3f5f4e7 100755
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -170,7 +170,7 @@ static function_entry IntlDateFormatter_class_functions[] = {
PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), datefmt_parse_args )
PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_intldateformatter_getdatetype )
PHP_NAMED_FE( getErrorMessage, ZEND_FN( datefmt_get_error_message ), arginfo_intldateformatter_getdatetype )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index 46d61fb1f..b306bbede 100755
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -233,7 +233,9 @@ PHP_FUNCTION( numfmt_set_text_attribute )
/* Actually set new attribute value. */
unum_setTextAttribute(FORMATTER_OBJECT(nfo), attribute, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting text attribute" );
RETURN_TRUE;
@@ -326,7 +328,9 @@ PHP_FUNCTION( numfmt_set_symbol )
/* Actually set the symbol. */
unum_setSymbol(FORMATTER_OBJECT(nfo), symbol, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting symbol value" );
RETURN_TRUE;
@@ -406,7 +410,9 @@ PHP_FUNCTION( numfmt_set_pattern )
/* TODO: add parse error information */
unum_applyPattern(FORMATTER_OBJECT(nfo), 0, svalue, slength, NULL, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting pattern value" );
RETURN_TRUE;
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index 07d07b64c..0bb5894f0 100755
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -179,7 +179,7 @@ static function_entry NumberFormatter_class_functions[] = {
PHP_NAMED_FE( getLocale, ZEND_FN( numfmt_get_locale ), arginfo_numberformatter_getlocale )
PHP_NAMED_FE( getErrorCode, ZEND_FN( numfmt_get_error_code ), arginfo_numberformatter_getpattern )
PHP_NAMED_FE( getErrorMessage, ZEND_FN( numfmt_get_error_message ), arginfo_numberformatter_getpattern )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index b73095d3e..cbdde855d 100755
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -107,7 +107,9 @@ PHP_FUNCTION( numfmt_parse )
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
}
@@ -161,7 +163,9 @@ PHP_FUNCTION( numfmt_parse_currency )
zval_dtor(zposition);
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
/* Convert parsed currency to UTF-8 and pass it back to caller. */
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 1784d028a..719015fe6 100755
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -84,13 +84,17 @@ PHP_FUNCTION(grapheme_strlen)
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
RETURN_NULL();
}
ret_len = grapheme_split_string(ustring, ustring_len, NULL, 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
if (ret_len >= 0) {
RETVAL_LONG(ret_len);
@@ -447,7 +451,9 @@ PHP_FUNCTION(grapheme_substr)
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
RETURN_FALSE;
}
@@ -485,7 +491,9 @@ PHP_FUNCTION(grapheme_substr)
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: start not contained in string", 1 TSRMLS_CC );
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
RETURN_FALSE;
}
@@ -499,7 +507,9 @@ PHP_FUNCTION(grapheme_substr)
status = U_ZERO_ERROR;
intl_convert_utf16_to_utf8((char **)&sub_str, &sub_str_len, ustr + sub_str_start_pos, ustr_len - sub_str_start_pos, &status);
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
ubrk_close( bi );
if ( U_FAILURE( status ) ) {
@@ -509,7 +519,9 @@ PHP_FUNCTION(grapheme_substr)
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
- efree( sub_str );
+ if (sub_str) {
+ efree( sub_str );
+ }
RETURN_FALSE;
}
@@ -665,7 +677,7 @@ PHP_FUNCTION(grapheme_stristr)
/* }}} */
/* {{{ grapheme_extract_charcount_iter - grapheme iterator for grapheme_extract MAXCHARS */
-inline int32_t
+static inline int32_t
grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char *pstr, int32_t str_len)
{
int pos = 0, prev_pos = 0;
@@ -702,7 +714,7 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char
/* }}} */
/* {{{ grapheme_extract_bytecount_iter - grapheme iterator for grapheme_extract MAXBYTES */
-inline int32_t
+static inline int32_t
grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char *pstr, int32_t str_len)
{
int pos = 0, prev_pos = 0;
@@ -736,7 +748,7 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char
/* }}} */
/* {{{ grapheme_extract_count_iter - grapheme iterator for grapheme_extract COUNT */
-inline int32_t
+static inline int32_t
grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pstr, int32_t str_len)
{
int pos = 0, next_pos = 0;
@@ -897,7 +909,9 @@ PHP_FUNCTION(grapheme_extract)
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, pstr, str_len);
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
if ( NULL != next ) {
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 1978d274a..92008554d 100755
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -170,7 +170,9 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -187,7 +189,9 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
}
@@ -203,8 +207,12 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
}
@@ -260,8 +268,12 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
}
exit:
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
@@ -295,7 +307,9 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -310,8 +324,9 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
-
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
@@ -332,8 +347,12 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
@@ -347,8 +366,12 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
*puchar_pos = ubrk_current(bi);
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
@@ -409,7 +432,7 @@ int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_a
/* }}} */
/* {{{ grapheme_count_graphemes */
-inline int32_t
+int32_t
grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len)
{
int ret_len = 0;
@@ -433,7 +456,7 @@ grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len)
/* }}} */
/* {{{ grapheme_memnstr_grapheme: find needle in haystack using grapheme boundaries */
-inline int32_t
+int32_t
grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end)
{
UChar *p = haystack;
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index f8207cac5..675c6481b 100755
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
@@ -36,10 +36,10 @@ int grapheme_ascii_check(const unsigned char *day, int32_t len);
int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_array[], int boundary_array_len TSRMLS_DC );
-inline int32_t
+int32_t
grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len);
-inline int32_t
+int32_t
grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end);
inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 728172a8b..e2b4a30d5 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -15,7 +15,7 @@
| Author: Pierre A. Joye <pierre@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: idn.c 292566 2009-12-23 21:41:05Z stas $ */
+/* $Id: idn.c 314218 2011-08-04 00:59:43Z felipe $ */
/* {{{ includes */
#ifdef HAVE_CONFIG_H
@@ -85,7 +85,9 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, int mode)
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree(ustring);
+ if (ustring) {
+ efree(ustring);
+ }
RETURN_FALSE;
} else {
UParseError parse_error;
diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c
index 7cde68892..3e70d1897 100755
--- a/ext/intl/locale/locale_class.c
+++ b/ext/intl/locale/locale_class.c
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: locale_class.c 269153 2008-11-17 11:28:01Z felipe $ */
+/* $Id: locale_class.c 314352 2011-08-06 01:22:27Z felipe $ */
#include <unicode/uloc.h>
#include "php_intl.h"
@@ -85,7 +85,7 @@ function_entry Locale_class_functions[] = {
ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), locale_4_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c
index 47350b2b4..cf3466514 100755
--- a/ext/intl/msgformat/msgformat_attr.c
+++ b/ext/intl/msgformat/msgformat_attr.c
@@ -90,7 +90,9 @@ PHP_FUNCTION( msgfmt_set_pattern )
/* TODO: add parse error information */
umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo));
- efree(spattern);
+ if (spattern) {
+ efree(spattern);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Error setting symbol value");
if(mfo->mf_data.orig_format) {
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index bd291291e..7ed28df3d 100755
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -144,7 +144,7 @@ static function_entry MessageFormatter_class_functions[] = {
PHP_NAMED_FE( getLocale, ZEND_FN( msgfmt_get_locale ), arginfo_messageformatter_geterrormessage )
PHP_NAMED_FE( getErrorCode, ZEND_FN( msgfmt_get_error_code ), arginfo_messageformatter_geterrormessage )
PHP_NAMED_FE( getErrorMessage, ZEND_FN( msgfmt_get_error_message ), arginfo_messageformatter_geterrormessage )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c
index 61c5213f0..8393d4c6e 100755
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -40,7 +40,9 @@ static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, int src_
INTL_METHOD_CHECK_STATUS(mfo, "Converting parse string failed");
umsg_parse_helper(MSG_FORMAT_OBJECT(mfo), &count, &fargs, usource, usrc_len, &INTL_DATA_ERROR_CODE(mfo));
- efree(usource);
+ if (usource) {
+ efree(usource);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Parsing failed");
array_init(return_value);
diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c
index 75894fffc..c5adf781a 100755
--- a/ext/intl/normalizer/normalizer_class.c
+++ b/ext/intl/normalizer/normalizer_class.c
@@ -44,7 +44,7 @@ ZEND_END_ARG_INFO()
function_entry Normalizer_class_functions[] = {
ZEND_FENTRY( normalize, ZEND_FN( normalizer_normalize ), normalizer_3_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
ZEND_FENTRY( isNormalized, ZEND_FN( normalizer_is_normalized ), normalizer_3_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c
index 482c4a01e..466ab97e1 100755
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
@@ -96,7 +96,9 @@ PHP_FUNCTION( normalizer_normalize )
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
@@ -220,7 +222,9 @@ PHP_FUNCTION( normalizer_is_normalized )
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index a9bfefd14..dc6c0fffa 100755
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -487,7 +487,7 @@ zend_function_entry intl_functions[] = {
PHP_FE( intl_is_failure, intl_1_arg )
PHP_FE( intl_error_name, intl_1_arg )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
@@ -543,6 +543,10 @@ PHP_MINIT_FUNCTION( intl )
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_CS);
+ REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
+#ifdef U_ICU_DATA_VERSION
+ REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
+#endif
/* Register 'Collator' PHP class */
collator_register_Collator_class( TSRMLS_C );
@@ -647,6 +651,9 @@ PHP_MINFO_FUNCTION( intl )
php_info_print_table_header( 2, "Internationalization support", "enabled" );
php_info_print_table_row( 2, "version", INTL_MODULE_VERSION );
php_info_print_table_row( 2, "ICU version", U_ICU_VERSION );
+#ifdef U_ICU_DATA_VERSION
+ php_info_print_table_row( 2, "ICU Data version", U_ICU_DATA_VERSION );
+#endif
php_info_print_table_end();
/* For the default locale php.ini setting */
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index a8a4bf1c8..3bf3468e3 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -102,7 +102,11 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
- rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+ if (fallback) {
+ rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+ } else {
+ rb->me = ures_openDirect(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+ }
INTL_CTOR_CHECK_STATUS(rb, "resourcebundle_ctor: Cannot load libICU resource bundle");
@@ -395,7 +399,7 @@ static function_entry ResourceBundle_class_functions[] = {
ZEND_NAMED_ME( getLocales, ZEND_FN(resourcebundle_locales), arginfo_resourcebundle_getlocales, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
ZEND_NAMED_ME( getErrorCode, ZEND_FN(resourcebundle_get_error_code), arginfo_resourcebundle_get_error_code, ZEND_ACC_PUBLIC )
ZEND_NAMED_ME( getErrorMessage, ZEND_FN(resourcebundle_get_error_message), arginfo_resourcebundle_get_error_message, ZEND_ACC_PUBLIC )
- { NULL, NULL, NULL }
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h
index 65330dd16..4755d723b 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.h
+++ b/ext/intl/resourcebundle/resourcebundle_class.h
@@ -20,6 +20,7 @@
#include <unicode/ures.h>
#include <zend.h>
+#include "php.h"
#include "intl_error.h"
diff --git a/ext/intl/tests/intl_icu_data_version_constant.phpt b/ext/intl/tests/intl_icu_data_version_constant.phpt
new file mode 100644
index 000000000..ad0121858
--- /dev/null
+++ b/ext/intl/tests/intl_icu_data_version_constant.phpt
@@ -0,0 +1,10 @@
+--TEST--
+INTL_ICU_DATA_VERSION constant
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) || version_compare('INTL_ICU_VERSION', '4.4', '<') ) print 'skip'; ?>
+--FILE--
+<?php
+var_dump(defined("INTL_ICU_DATA_VERSION"));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/intl/tests/intl_icu_version_constant.phpt b/ext/intl/tests/intl_icu_version_constant.phpt
new file mode 100644
index 000000000..13160693c
--- /dev/null
+++ b/ext/intl/tests/intl_icu_version_constant.phpt
@@ -0,0 +1,10 @@
+--TEST--
+INTL_ICU_VERSION constant
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+var_dump(defined("INTL_ICU_VERSION"));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/intl/tests/resourcebundle_create.phpt b/ext/intl/tests/resourcebundle_create.phpt
index 4d96d3eff..2bf4f556a 100644
--- a/ext/intl/tests/resourcebundle_create.phpt
+++ b/ext/intl/tests/resourcebundle_create.phpt
@@ -57,6 +57,6 @@ ResourceBundle Object
-127: U_USING_DEFAULT_WARNING
NULL
- -127: resourcebundle_ctor: Cannot load libICU resource '%s/resourcebundle' without fallback from en_US to root: U_USING_DEFAULT_WARNING
+ 2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
NULL
2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
diff --git a/ext/intl/tests/resourcebundle_internal.phpt b/ext/intl/tests/resourcebundle_internal.phpt
new file mode 100644
index 000000000..fe90081e7
--- /dev/null
+++ b/ext/intl/tests/resourcebundle_internal.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test ResourceBundle::__construct() with internal ICU bundles
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) || !defined('INTL_ICU_DATA_VERSION') || version_compare(INTL_ICU_DATA_VERSION, '4.4', '<') ) print 'skip'; ?>
+--FILE--
+<?php
+$b = new ResourceBundle('de_DE', 'ICUDATA-region');
+var_dump($b->get('Countries')->get('DE'));
+
+$b = new ResourceBundle('icuver', 'ICUDATA');
+var_dump($b->get('ICUVersion') !== NULL);
+
+$b = new ResourceBundle('supplementalData', 'ICUDATA', false);
+var_dump($b->get('cldrVersion') !== NULL);
+?>
+--EXPECTF--
+string(11) "Deutschland"
+bool(true)
+bool(true)