summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-04-01 21:28:54 +0200
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-04-01 23:28:01 +0100
commit95fbae891a653758a0e52879af808af7eedfb043 (patch)
treeeac7a015b341bf1a474fd0d1a65c5487f50c9288 /ext
parent69f75bb43c7e6f2e8b4661ff48aaf68b9b9b2c5c (diff)
downloadphp-git-95fbae891a653758a0e52879af808af7eedfb043.tar.gz
Compatibility with old versions of ICU (4.0+).
Diffstat (limited to 'ext')
-rw-r--r--ext/intl/calendar/calendar_class.cpp10
-rw-r--r--ext/intl/calendar/calendar_methods.cpp8
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp5
-rw-r--r--ext/intl/common/common_enum.cpp3
-rw-r--r--ext/intl/intl_convertcpp.cpp3
-rwxr-xr-xext/intl/msgformat/msgformat_helpers.cpp3
-rwxr-xr-xext/intl/php_intl.c12
-rw-r--r--ext/intl/tests/calendar_createInstance_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_createInstance_variation1.phpt2
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_error.phpt2
-rw-r--r--ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt2
-rw-r--r--ext/intl/tests/calendar_getLocale_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getTimeZone_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getWeekendTransition_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getWeekendTransition_error.phpt2
-rw-r--r--ext/intl/tests/calendar_isWeekend_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_isWeekend_error.phpt2
-rw-r--r--ext/intl/tests/calendar_setTimeZone_basic.phpt2
-rw-r--r--ext/intl/tests/gregoriancalendar___construct_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZone_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_getDisplayName_variant2.phpt2
-rw-r--r--ext/intl/tests/timezone_getRegion_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_getRegion_error.phpt2
-rw-r--r--ext/intl/timezone/timezone_class.cpp9
-rw-r--r--ext/intl/timezone/timezone_class.h3
-rw-r--r--ext/intl/timezone/timezone_methods.cpp6
33 files changed, 108 insertions, 0 deletions
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index c4119624af..1a477396dd 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -377,7 +377,9 @@ ZEND_END_ARG_INFO()
static const zend_function_entry Calendar_class_functions[] = {
PHP_ME(IntlCalendar, __construct, ainfo_cal_void, ZEND_ACC_PRIVATE)
PHP_ME_MAPPING(createInstance, intlcal_create_instance, ainfo_cal_createInstance, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 42
PHP_ME_MAPPING(getKeywordValuesForLocale, intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+#endif
PHP_ME_MAPPING(getNow, intlcal_get_now, ainfo_cal_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getAvailableLocales, intlcal_get_available_locales, ainfo_cal_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(get, intlcal_get, ainfo_cal_field, ZEND_ACC_PUBLIC)
@@ -393,7 +395,9 @@ static const zend_function_entry Calendar_class_functions[] = {
PHP_ME_MAPPING(fieldDifference, intlcal_field_difference, ainfo_cal_field_difference, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getActualMaximum, intlcal_get_actual_maximum, ainfo_cal_field, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getActualMinimum, intlcal_get_actual_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_ME_MAPPING(getDayOfWeekType, intlcal_get_day_of_week_type, ainfo_cal_dow, ZEND_ACC_PUBLIC)
+#endif
PHP_ME_MAPPING(getFirstDayOfWeek, intlcal_get_first_day_of_week, ainfo_cal_void, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getGreatestMinimum, intlcal_get_greatest_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getLeastMaximum, intlcal_get_least_maximum, ainfo_cal_field, ZEND_ACC_PUBLIC)
@@ -403,12 +407,16 @@ static const zend_function_entry Calendar_class_functions[] = {
PHP_ME_MAPPING(getMinimum, intlcal_get_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getTimeZone, intlcal_get_time_zone, ainfo_cal_void, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getType, intlcal_get_type, ainfo_cal_void, ZEND_ACC_PUBLIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_ME_MAPPING(getWeekendTransition,intlcal_get_weekend_transition, ainfo_cal_dow, ZEND_ACC_PUBLIC)
+#endif
PHP_ME_MAPPING(inDaylightTime, intlcal_in_daylight_time, ainfo_cal_void, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(isEquivalentTo, intlcal_is_equivalent_to, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(isLenient, intlcal_is_lenient, ainfo_cal_void, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(isSet, intlcal_is_set, ainfo_cal_field, ZEND_ACC_PUBLIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_ME_MAPPING(isWeekend, intlcal_is_weekend, ainfo_cal_date_optional, ZEND_ACC_PUBLIC)
+#endif
PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, ainfo_cal_dow, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(setLenient, intlcal_set_lenient, ainfo_cal_setLenient, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(equals, intlcal_equals, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
@@ -510,10 +518,12 @@ void calendar_register_IntlCalendar_class(TSRMLS_D)
CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY);
CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY);
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY);
CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND);
CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET);
CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE);
+#endif
#if U_ICU_VERSION_MAJOR_NUM >= 49
CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST);
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index d84ad65eeb..f8d977c428 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -77,6 +77,7 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance)
calendar_object_create(return_value, cal TSRMLS_CC);
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 42
class BugStringCharEnumeration : public StringEnumeration
{
public:
@@ -172,6 +173,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
IntlIterator_from_StringEnumeration(se, return_value TSRMLS_CC);
}
+#endif //ICU 4.2 only
U_CFUNC PHP_FUNCTION(intlcal_get_now)
{
@@ -613,6 +615,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_actual_minimum)
"intlcal_get_actual_minimum", INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
{
long dow;
@@ -640,6 +643,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
RETURN_LONG((long)result);
}
+#endif
U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)
{
@@ -804,6 +808,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type)
RETURN_STRING(co->ucal->getType(), 1);
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
{
long dow;
@@ -831,6 +836,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
RETURN_LONG((long)res);
}
+#endif
U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time)
{
@@ -917,6 +923,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_set)
RETURN_BOOL((int)co->ucal->isSet((UCalendarDateFields)field));
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
{
double date;
@@ -945,6 +952,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
RETURN_BOOL((int)ret);
}
}
+#endif
U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week)
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index 712521a5ea..31fb8a8991 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -140,7 +140,12 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
}
timelib_tzinfo *tzinfo = get_timezone_info(TSRMLS_C);
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 42
UnicodeString tzstr = UnicodeString::fromUTF8(StringPiece(tzinfo->name));
+#else
+ UnicodeString tzstr = UnicodeString(tzinfo->name,
+ strlen(tzinfo->name), US_INV);
+#endif
if (tzstr.isBogus()) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlgregcal_create_instance: could not create UTF-8 string "
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index 08f6c858cb..14265d4597 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -18,6 +18,9 @@
#include "config.h"
#endif
+// Fix build on Windows/old versions of ICU
+#include <stdio.h>
+
#include "common_enum.h"
extern "C" {
diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp
index 84988ef647..8dddc70293 100644
--- a/ext/intl/intl_convertcpp.cpp
+++ b/ext/intl/intl_convertcpp.cpp
@@ -16,6 +16,9 @@
/* $Id$ */
+//Fixes the build on old versions of ICU with Windows
+#include <stdio.h>
+
#include "intl_convertcpp.h"
#include <unicode/ustring.h>
extern "C" {
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 1895de2c86..508bdb6658 100755
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -18,6 +18,9 @@
#include "config.h"
#endif
+// Fix build on Windows / old versions of ICU
+#include <stdio.h>
+
#include <math.h>
#include <unicode/msgfmt.h>
#include <unicode/chariter.h>
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index bc67443c54..f160f9dda2 100755
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -723,9 +723,13 @@ zend_function_entry intl_functions[] = {
#endif
PHP_FE( intltz_create_enumeration, arginfo_tz_create_enumeration )
PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration )
+#endif
PHP_FE( intltz_get_canonical_id, arginfo_tz_get_canonical_id )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_FE( intltz_get_region, arginfo_tz_idarg_static )
+#endif
PHP_FE( intltz_get_tz_data_version, arginfo_tz_void )
PHP_FE( intltz_get_equivalent_id, arginfo_tz_get_equivalent_id )
PHP_FE( intltz_use_daylight_time, arginfo_tz_only_tz )
@@ -738,7 +742,9 @@ zend_function_entry intl_functions[] = {
PHP_FE( intltz_get_error_message, arginfo_tz_only_tz )
PHP_FE( intlcal_create_instance, ainfo_cal_create_instance )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 42
PHP_FE( intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale )
+#endif
PHP_FE( intlcal_get_now, ainfo_cal_void )
PHP_FE( intlcal_get_available_locales, ainfo_cal_void )
PHP_FE( intlcal_get, ainfo_cal_field )
@@ -754,7 +760,9 @@ zend_function_entry intl_functions[] = {
PHP_FE( intlcal_field_difference, ainfo_cal_field_difference )
PHP_FE( intlcal_get_actual_maximum, ainfo_cal_field )
PHP_FE( intlcal_get_actual_minimum, ainfo_cal_field )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_FE( intlcal_get_day_of_week_type, ainfo_cal_dow )
+#endif
PHP_FE( intlcal_get_first_day_of_week, ainfo_cal_only_cal )
PHP_FE( intlcal_get_greatest_minimum, ainfo_cal_field )
PHP_FE( intlcal_get_least_maximum, ainfo_cal_field )
@@ -764,12 +772,16 @@ zend_function_entry intl_functions[] = {
PHP_FE( intlcal_get_minimum, ainfo_cal_field )
PHP_FE( intlcal_get_time_zone, ainfo_cal_only_cal )
PHP_FE( intlcal_get_type, ainfo_cal_only_cal )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_FE( intlcal_get_weekend_transition, ainfo_cal_dow )
+#endif
PHP_FE( intlcal_in_daylight_time, ainfo_cal_only_cal )
PHP_FE( intlcal_is_equivalent_to, ainfo_cal_other_cal )
PHP_FE( intlcal_is_lenient, ainfo_cal_only_cal )
PHP_FE( intlcal_is_set, ainfo_cal_field )
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
PHP_FE( intlcal_is_weekend, ainfo_cal_date_optional )
+#endif
PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow )
PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient )
PHP_FE( intlcal_equals, ainfo_cal_other_cal )
diff --git a/ext/intl/tests/calendar_createInstance_basic.phpt b/ext/intl/tests/calendar_createInstance_basic.phpt
index 3c40b98b42..e062030fec 100644
--- a/ext/intl/tests/calendar_createInstance_basic.phpt
+++ b/ext/intl/tests/calendar_createInstance_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::createInstance() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_createInstance_variation1.phpt b/ext/intl/tests/calendar_createInstance_variation1.phpt
index a68e199feb..138f2a2afd 100644
--- a/ext/intl/tests/calendar_createInstance_variation1.phpt
+++ b/ext/intl/tests/calendar_createInstance_variation1.phpt
@@ -4,6 +4,8 @@ IntlCalendar::createInstance() argument variations
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
index 05dc2e4b00..ce9a964eec 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getDayOfWeekType() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
index 29647c3300..44a8d154fd 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getDayOfWeekOfType(): bad arguments
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
index fbd40053ca..dedfcea8fe 100644
--- a/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
+++ b/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getKeywordValuesForLocale() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.2') < 0)
+ die('skip for ICU 4.2+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
index c95e6097d2..2aa8002bd1 100644
--- a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
+++ b/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getKeywordValuesForLocale(): bad arguments
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.2') < 0)
+ die('skip for ICU 4.2+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getLocale_basic.phpt b/ext/intl/tests/calendar_getLocale_basic.phpt
index 55937d6aa9..63f846f9a8 100644
--- a/ext/intl/tests/calendar_getLocale_basic.phpt
+++ b/ext/intl/tests/calendar_getLocale_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getLocale() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
index d345b7cd2b..eeaa3104a8 100644
--- a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
+++ b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getMinimalDaysInFirstWeek() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getTimeZone_basic.phpt b/ext/intl/tests/calendar_getTimeZone_basic.phpt
index 3a1edb5c6b..fd9aff1f99 100644
--- a/ext/intl/tests/calendar_getTimeZone_basic.phpt
+++ b/ext/intl/tests/calendar_getTimeZone_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getTimeZone() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getWeekendTransition_basic.phpt b/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
index ea8372d7df..55ab464a17 100644
--- a/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
+++ b/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getWeekendTransition() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_getWeekendTransition_error.phpt b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
index dbae310830..6ca13dc861 100644
--- a/ext/intl/tests/calendar_getWeekendTransition_error.phpt
+++ b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
@@ -4,6 +4,8 @@ IntlCalendar::getWeekendTransition(): bad arguments
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_isWeekend_basic.phpt b/ext/intl/tests/calendar_isWeekend_basic.phpt
index c520aacdcc..862b4e05d9 100644
--- a/ext/intl/tests/calendar_isWeekend_basic.phpt
+++ b/ext/intl/tests/calendar_isWeekend_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::isWeekend basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_isWeekend_error.phpt b/ext/intl/tests/calendar_isWeekend_error.phpt
index e4a4649e6d..831bcd1832 100644
--- a/ext/intl/tests/calendar_isWeekend_error.phpt
+++ b/ext/intl/tests/calendar_isWeekend_error.phpt
@@ -4,6 +4,8 @@ IntlCalendar::isWeekend(): bad arguments
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.4') < 0)
+ die('skip for ICU 4.4+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/calendar_setTimeZone_basic.phpt b/ext/intl/tests/calendar_setTimeZone_basic.phpt
index 0609509038..525840ddd6 100644
--- a/ext/intl/tests/calendar_setTimeZone_basic.phpt
+++ b/ext/intl/tests/calendar_setTimeZone_basic.phpt
@@ -4,6 +4,8 @@ IntlCalendar::setTimeZone() basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/gregoriancalendar___construct_basic.phpt b/ext/intl/tests/gregoriancalendar___construct_basic.phpt
index ed6b04341b..bdbef6725b 100644
--- a/ext/intl/tests/gregoriancalendar___construct_basic.phpt
+++ b/ext/intl/tests/gregoriancalendar___construct_basic.phpt
@@ -4,6 +4,8 @@ IntlGregorianCalendar::__construct(): basic
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
index c908513926..9ceffc5289 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::createTimeZoneIDEnumeration(): basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
index 5c7dbe5af3..2cc2ac48e7 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::createTimeZoneIDEnumeration(): errors
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
index 1447458a7f..d57dfbf42f 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::createTimeZoneIDEnumeration(): variant without offset
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
index 7e1207d344..2afe171c58 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::createTimeZoneIDEnumeration(): variant without region
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_createTimeZone_basic.phpt b/ext/intl/tests/timezone_createTimeZone_basic.phpt
index bb5e51e10b..e79f5b58ee 100644
--- a/ext/intl/tests/timezone_createTimeZone_basic.phpt
+++ b/ext/intl/tests/timezone_createTimeZone_basic.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::createTimeZone(): basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_getDisplayName_variant2.phpt b/ext/intl/tests/timezone_getDisplayName_variant2.phpt
index fd03550467..1ccf68767f 100644
--- a/ext/intl/tests/timezone_getDisplayName_variant2.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_variant2.phpt
@@ -6,6 +6,8 @@ if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '49') >= 0)
die('skip for ICU < 49');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_getRegion_basic.phpt b/ext/intl/tests/timezone_getRegion_basic.phpt
index ba4285a971..1a41ae8d58 100644
--- a/ext/intl/tests/timezone_getRegion_basic.phpt
+++ b/ext/intl/tests/timezone_getRegion_basic.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::getRegion(): basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/timezone_getRegion_error.phpt b/ext/intl/tests/timezone_getRegion_error.phpt
index 9d08bbbde0..34911d9abc 100644
--- a/ext/intl/tests/timezone_getRegion_error.phpt
+++ b/ext/intl/tests/timezone_getRegion_error.phpt
@@ -4,6 +4,8 @@ IntlTimeZone::getRegion(): errors
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip for ICU 4.8+');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index dcd62929ca..ad9e6fd839 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -376,9 +376,13 @@ static zend_function_entry TimeZone_class_functions[] = {
#endif
PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, ainfo_tz_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#endif
PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, ainfo_tz_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
PHP_ME_MAPPING(getRegion, intltz_get_region, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+#endif
PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, ainfo_tz_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
@@ -426,16 +430,21 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D)
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG);
+
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
+#endif
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
+#endif
/* Declare 'IntlTimeZone' class properties */
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index a239a18b67..89d694621f 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -20,6 +20,9 @@
//redefinition of inline in PHP headers causes problems, so include this before
#include <math.h>
+//fixes the build on windows for old versions of ICU
+#include <stdio.h>
+
#include <php.h>
#include "intl_error.h"
#include "intl_data.h"
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 37b3996706..eaa6b46e39 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -189,6 +189,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
RETURN_LONG((long)result);
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
{
long zoneType,
@@ -243,6 +244,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
IntlIterator_from_StringEnumeration(se, return_value TSRMLS_CC);
}
+#endif
U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
{
@@ -283,6 +285,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
}
}
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
U_CFUNC PHP_FUNCTION(intltz_get_region)
{
char *str_id;
@@ -310,6 +313,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
RETURN_STRINGL(outbuf, region_len, 1);
}
+#endif
U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
{
@@ -477,9 +481,11 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
static const TimeZone::EDisplayType display_types[] = {
TimeZone::SHORT, TimeZone::LONG,
+#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
TimeZone::SHORT_GENERIC, TimeZone::LONG_GENERIC,
TimeZone::SHORT_GMT, TimeZone::LONG_GMT,
TimeZone::SHORT_COMMONLY_USED, TimeZone::GENERIC_LOCATION
+#endif
};
U_CFUNC PHP_FUNCTION(intltz_get_display_name)