Browse Source

Compatibility with old versions of ICU (4.0+).

pull/23/merge
Gustavo André dos Santos Lopes 14 years ago
parent
commit
95fbae891a
  1. 10
      ext/intl/calendar/calendar_class.cpp
  2. 8
      ext/intl/calendar/calendar_methods.cpp
  3. 5
      ext/intl/calendar/gregoriancalendar_methods.cpp
  4. 3
      ext/intl/common/common_enum.cpp
  5. 3
      ext/intl/intl_convertcpp.cpp
  6. 3
      ext/intl/msgformat/msgformat_helpers.cpp
  7. 12
      ext/intl/php_intl.c
  8. 2
      ext/intl/tests/calendar_createInstance_basic.phpt
  9. 2
      ext/intl/tests/calendar_createInstance_variation1.phpt
  10. 2
      ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
  11. 2
      ext/intl/tests/calendar_getDayOfWeekType_error.phpt
  12. 2
      ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
  13. 2
      ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
  14. 2
      ext/intl/tests/calendar_getLocale_basic.phpt
  15. 2
      ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
  16. 2
      ext/intl/tests/calendar_getTimeZone_basic.phpt
  17. 2
      ext/intl/tests/calendar_getWeekendTransition_basic.phpt
  18. 2
      ext/intl/tests/calendar_getWeekendTransition_error.phpt
  19. 2
      ext/intl/tests/calendar_isWeekend_basic.phpt
  20. 2
      ext/intl/tests/calendar_isWeekend_error.phpt
  21. 2
      ext/intl/tests/calendar_setTimeZone_basic.phpt
  22. 2
      ext/intl/tests/gregoriancalendar___construct_basic.phpt
  23. 2
      ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
  24. 2
      ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
  25. 2
      ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
  26. 2
      ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
  27. 2
      ext/intl/tests/timezone_createTimeZone_basic.phpt
  28. 2
      ext/intl/tests/timezone_getDisplayName_variant2.phpt
  29. 2
      ext/intl/tests/timezone_getRegion_basic.phpt
  30. 2
      ext/intl/tests/timezone_getRegion_error.phpt
  31. 9
      ext/intl/timezone/timezone_class.cpp
  32. 3
      ext/intl/timezone/timezone_class.h
  33. 6
      ext/intl/timezone/timezone_methods.cpp

10
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);

8
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)

5
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 "

3
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" {

3
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" {

3
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>

12
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 )

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

2
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);

9
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 */

3
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"

6
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)

Loading…
Cancel
Save