|
15 | 15 | #include "php.h" |
16 | 16 | #include "php_intl.h" |
17 | 17 | #include <unicode/ulistformatter.h> |
18 | | -#include "listformatter_arginfo.h" |
19 | 18 | #include "listformatter_class.h" |
| 19 | +#include "listformatter_arginfo.h" |
20 | 20 | #include "intl_convert.h" |
21 | 21 |
|
22 | 22 | static zend_object_handlers listformatter_handlers; |
@@ -53,8 +53,13 @@ PHP_METHOD(IntlListFormatter, __construct) |
53 | 53 | ListFormatter_object *obj = Z_INTL_LISTFORMATTER_P(ZEND_THIS); |
54 | 54 | char* locale; |
55 | 55 | size_t locale_len = 0; |
56 | | - zend_long type = ULISTFMT_TYPE_AND; |
57 | | - zend_long width = ULISTFMT_WIDTH_WIDE; |
| 56 | + #if U_ICU_VERSION_MAJOR_NUM >= 67 |
| 57 | + zend_long type = ULISTFMT_TYPE_AND; |
| 58 | + zend_long width = ULISTFMT_WIDTH_WIDE; |
| 59 | + #else |
| 60 | + zend_long type = INTL_LISTFORMATTER_FALLBACK_TYPE_AND; |
| 61 | + zend_long width = INTL_LISTFORMATTER_FALLBACK_WIDTH_WIDE; |
| 62 | + #endif |
58 | 63 | ZEND_PARSE_PARAMETERS_START(1, 3) |
59 | 64 | Z_PARAM_STRING(locale, locale_len) |
60 | 65 | Z_PARAM_OPTIONAL |
@@ -90,12 +95,12 @@ PHP_METHOD(IntlListFormatter, __construct) |
90 | 95 |
|
91 | 96 | LISTFORMATTER_OBJECT(obj) = ulistfmt_openForType(locale, type, width, &status); |
92 | 97 | #else |
93 | | - if (type != ULISTFMT_TYPE_AND) { |
| 98 | + if (type != INTL_LISTFORMATTER_FALLBACK_TYPE_AND) { |
94 | 99 | zend_argument_value_error(2, "contains an unsupported type. ICU 66 and below only support IntlListFormatter::TYPE_AND"); |
95 | 100 | RETURN_THROWS(); |
96 | 101 | } |
97 | 102 |
|
98 | | - if (width != ULISTFMT_WIDTH_WIDE) { |
| 103 | + if (width != INTL_LISTFORMATTER_FALLBACK_WIDTH_WIDE) { |
99 | 104 | zend_argument_value_error(3, "contains an unsupported width. ICU 66 and below only support IntlListFormatter::WIDTH_WIDE"); |
100 | 105 | RETURN_THROWS(); |
101 | 106 | } |
|
0 commit comments