1 Based on the following upstream commits:
3 https://github.com/php/php-src/commit/8d35a423838eb462cd39ee535c5d003073cc5f22
4 https://github.com/php/php-src/commit/d8200e48857aeaf09f7127751efc5632ef7660a7
5 https://github.com/php/php-src/commit/9a8e7b571896f39f83cb000fdb7c466b6d328d52
7 --- a/ext/intl/breakiterator/breakiterator_class.cpp
8 +++ b/ext/intl/breakiterator/breakiterator_class.cpp
9 @@ -38,6 +38,7 @@ extern "C" {
12 using PHP::CodePointBreakIterator;
13 +using icu::RuleBasedBreakIterator;
15 /* {{{ Global variables */
16 zend_class_entry *BreakIterator_ce_ptr;
17 --- a/ext/intl/breakiterator/breakiterator_class.h
18 +++ b/ext/intl/breakiterator/breakiterator_class.h
21 #ifndef USE_BREAKITERATOR_POINTER
22 typedef void BreakIterator;
24 +using icu::BreakIterator;
28 --- a/ext/intl/breakiterator/breakiterator_methods.cpp
29 +++ b/ext/intl/breakiterator/breakiterator_methods.cpp
30 @@ -32,6 +32,8 @@ extern "C" {
33 using PHP::CodePointBreakIterator;
34 +using icu::BreakIterator;
37 U_CFUNC PHP_METHOD(BreakIterator, __construct)
39 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp
40 +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
41 @@ -33,6 +33,8 @@ typedef union {
45 +using icu::UCharCharacterIterator;
47 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator);
49 CodePointBreakIterator::CodePointBreakIterator()
50 --- a/ext/intl/breakiterator/codepointiterator_internal.h
51 +++ b/ext/intl/breakiterator/codepointiterator_internal.h
53 #define CODEPOINTITERATOR_INTERNAL_H
55 #include <unicode/brkiter.h>
56 +#include <unicode/unistr.h>
58 -using U_ICU_NAMESPACE::BreakIterator;
59 +using icu::BreakIterator;
60 +using icu::CharacterIterator;
61 +using icu::UnicodeString;
65 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
66 +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
67 @@ -26,6 +26,9 @@ extern "C" {
68 #include "../intl_convertcpp.h"
69 #include "../intl_common.h"
71 +using icu::RuleBasedBreakIterator;
74 static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
75 return (RuleBasedBreakIterator*)bio->biter;
77 --- a/ext/intl/calendar/calendar_class.cpp
78 +++ b/ext/intl/calendar/calendar_class.cpp
79 @@ -34,6 +34,9 @@ extern "C" {
83 +using icu::GregorianCalendar;
86 /* {{{ Global variables */
87 zend_class_entry *Calendar_ce_ptr;
88 zend_class_entry *GregorianCalendar_ce_ptr;
89 --- a/ext/intl/calendar/calendar_class.h
90 +++ b/ext/intl/calendar/calendar_class.h
93 #ifndef USE_CALENDAR_POINTER
94 typedef void Calendar;
100 --- a/ext/intl/calendar/calendar_methods.cpp
101 +++ b/ext/intl/calendar/calendar_methods.cpp
102 @@ -40,6 +40,8 @@ extern "C" {
104 #include "../common/common_enum.h"
108 U_CFUNC PHP_METHOD(IntlCalendar, __construct)
110 zend_throw_exception( NULL,
111 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp
112 +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
114 #include <unicode/locid.h>
115 #include <unicode/calendar.h>
116 #include <unicode/gregocal.h>
117 +#include <unicode/ustring.h>
120 #include "../php_intl.h"
121 #include "../intl_common.h"
122 @@ -34,6 +36,11 @@ extern "C" {
123 #include "zend_exceptions.h"
126 +using icu::GregorianCalendar;
128 +using icu::UnicodeString;
129 +using icu::StringPiece;
131 static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
132 return (GregorianCalendar*)co->ucal;
134 --- a/ext/intl/common/common_date.cpp
135 +++ b/ext/intl/common/common_date.cpp
136 @@ -27,6 +27,9 @@ extern "C" {
138 #include "zend_portability.h"
140 +using icu::TimeZone;
141 +using icu::UnicodeString;
143 /* {{{ timezone_convert_datetimezone
144 * The timezone in DateTime and DateTimeZone is not unified. */
145 U_CFUNC TimeZone *timezone_convert_datetimezone(int type,
146 --- a/ext/intl/common/common_date.h
147 +++ b/ext/intl/common/common_date.h
148 @@ -28,6 +28,8 @@ U_CDECL_END
150 #include <unicode/timezone.h>
152 +using icu::TimeZone;
154 U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func);
155 U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
156 intl_error *err, const char *func);
157 --- a/ext/intl/common/common_enum.h
158 +++ b/ext/intl/common/common_enum.h
159 @@ -75,6 +75,7 @@ U_CFUNC zval *zoi_with_current_get_current_data(zend_object_iterator *iter);
160 U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter);
163 +using icu::StringEnumeration;
164 U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object);
167 --- a/ext/intl/converter/converter.c
168 +++ b/ext/intl/converter/converter.c
170 #include "zend_exceptions.h"
172 #include <unicode/utypes.h>
173 +#include <unicode/utf8.h>
174 +#include <unicode/utf16.h>
175 #include <unicode/ucnv.h>
176 #include <unicode/ustring.h>
178 --- a/ext/intl/dateformat/dateformat_format_object.cpp
179 +++ b/ext/intl/dateformat/dateformat_format_object.cpp
180 @@ -33,6 +33,12 @@ extern "C" {
181 #include "../common/common_date.h"
185 +using icu::DateFormat;
186 +using icu::GregorianCalendar;
187 +using icu::StringPiece;
188 +using icu::SimpleDateFormat;
190 static const DateFormat::EStyle valid_styles[] = {
193 --- a/ext/intl/dateformat/dateformat_helpers.cpp
194 +++ b/ext/intl/dateformat/dateformat_helpers.cpp
195 @@ -28,6 +28,8 @@ extern "C" {
196 #include "../calendar/calendar_class.h"
199 +using icu::GregorianCalendar;
201 int datefmt_process_calendar_arg(zval* calendar_zv,
202 Locale const& locale,
203 const char *func_name,
204 --- a/ext/intl/dateformat/dateformat_helpers.h
205 +++ b/ext/intl/dateformat/dateformat_helpers.h
209 #include <unicode/calendar.h>
210 +#include <unicode/datefmt.h>
213 #include "../php_intl.h"
217 +using icu::Calendar;
218 +using icu::DateFormat;
220 int datefmt_process_calendar_arg(zval* calendar_zv,
221 Locale const& locale,
222 const char *func_name,
223 --- a/ext/intl/grapheme/grapheme_string.c
224 +++ b/ext/intl/grapheme/grapheme_string.c
226 #include "grapheme_util.h"
228 #include <unicode/utypes.h>
229 +#include <unicode/utf8.h>
230 #include <unicode/ucol.h>
231 #include <unicode/ustring.h>
232 #include <unicode/ubrk.h>
233 @@ -834,10 +835,10 @@ PHP_FUNCTION(grapheme_extract)
236 /* just in case pstr points in the middle of a character, move forward to the start of the next char */
237 - if ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
238 - char *str_end = str + str_len;
239 + if ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
240 + unsigned char *str_end = str + str_len;
242 - while ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
243 + while ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
245 if ( pstr >= str_end ) {
246 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
247 --- a/ext/intl/intl_convertcpp.h
248 +++ b/ext/intl/intl_convertcpp.h
250 #include <unicode/unistr.h>
251 #include <zend_types.h>
253 +using icu::UnicodeString;
255 int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status);
257 zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status);
258 --- a/ext/intl/msgformat/msgformat_helpers.cpp
259 +++ b/ext/intl/msgformat/msgformat_helpers.cpp
260 @@ -78,6 +78,16 @@ MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
264 +using icu::Formattable;
266 +using icu::DateFormat;
267 +using icu::MessageFormat;
268 +#ifdef HAS_MESSAGE_PATTERN
269 +using icu::MessagePattern;
271 +using icu::MessageFormatAdapter;
272 +using icu::FieldPosition;
274 U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
276 int32_t fmt_count = 0;
277 @@ -229,15 +239,16 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
278 UnicodeString typeString = mp.getSubstring(type_part);
279 /* This is all based on the rules in the docs for MessageFormat
280 * @see http://icu-project.org/apiref/icu4c/classMessageFormat.html */
281 - if (typeString == "number") {
282 +#define ASCII_LITERAL(s) UNICODE_STRING(s, sizeof(s)-1)
283 + if (typeString == ASCII_LITERAL("number")) {
284 MessagePattern::Part style_part = mp.getPart(i + 1); /* Not advancing i */
285 if (style_part.getType() == UMSGPAT_PART_TYPE_ARG_STYLE) {
286 UnicodeString styleString = mp.getSubstring(style_part);
287 - if (styleString == "integer") {
288 + if (styleString == ASCII_LITERAL("integer")) {
289 type = Formattable::kInt64;
290 - } else if (styleString == "currency") {
291 + } else if (styleString == ASCII_LITERAL("currency")) {
292 type = Formattable::kDouble;
293 - } else if (styleString == "percent") {
294 + } else if (styleString == ASCII_LITERAL("percent")) {
295 type = Formattable::kDouble;
296 } else { /* some style invalid/unknown to us */
297 type = Formattable::kDouble;
298 @@ -245,12 +256,13 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
299 } else { // if missing style, part, make it a double
300 type = Formattable::kDouble;
302 - } else if ((typeString == "date") || (typeString == "time")) {
303 + } else if ((typeString == ASCII_LITERAL("date")) || (typeString == ASCII_LITERAL("time"))) {
304 type = Formattable::kDate;
305 - } else if ((typeString == "spellout") || (typeString == "ordinal")
306 - || (typeString == "duration")) {
307 + } else if ((typeString == ASCII_LITERAL("spellout")) || (typeString == ASCII_LITERAL("ordinal"))
308 + || (typeString == ASCII_LITERAL("duration"))) {
309 type = Formattable::kDouble;
311 +#undef ASCII_LITERAL
313 /* If there's no UMSGPAT_PART_TYPE_ARG_TYPE right after a
314 * UMSGPAT_ARG_TYPE_SIMPLE argument, then the pattern
315 --- a/ext/intl/normalizer/normalizer_normalize.c
316 +++ b/ext/intl/normalizer/normalizer_normalize.c
318 #include "normalizer_class.h"
319 #include "normalizer_normalize.h"
320 #include "intl_convert.h"
321 +#include <unicode/utf8.h>
323 /* {{{ proto string Normalizer::normalize( string $input [, string $form = FORM_C] )
324 * Normalize a string. }}} */
325 --- a/ext/intl/timezone/timezone_class.cpp
326 +++ b/ext/intl/timezone/timezone_class.cpp
327 @@ -37,6 +37,8 @@ extern "C" {
328 #include <ext/date/php_date.h>
331 +using icu::Calendar;
333 /* {{{ Global variables */
335 zend_class_entry *TimeZone_ce_ptr = NULL;
336 --- a/ext/intl/timezone/timezone_class.h
337 +++ b/ext/intl/timezone/timezone_class.h
340 #ifndef USE_TIMEZONE_POINTER
341 typedef void TimeZone;
343 +using icu::TimeZone;
347 --- a/ext/intl/timezone/timezone_methods.cpp
348 +++ b/ext/intl/timezone/timezone_methods.cpp
350 #include <unicode/locid.h>
351 #include <unicode/timezone.h>
352 #include <unicode/ustring.h>
353 +#include <unicode/calendar.h>
354 #include "intl_convertcpp.h"
356 #include "../common/common_date.h"
357 @@ -37,6 +38,9 @@ extern "C" {
359 #include "common/common_enum.h"
362 +using icu::Calendar;
364 U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
366 zend_throw_exception( NULL,
367 --- a/ext/intl/uchar/uchar.c
368 +++ b/ext/intl/uchar/uchar.c
370 #include "intl_convert.h"
372 #include <unicode/uchar.h>
373 +#include <unicode/utf8.h>
375 #define IC_METHOD(mname) PHP_METHOD(IntlChar, mname)