xref: /PHP-7.0/ext/intl/php_intl.c (revision c7aa8ba0)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | http://www.php.net/license/3_01.txt                                  |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Vadim Savchuk <vsavchuk@productengine.com>                  |
14    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
15    |          Stanislav Malyshev <stas@zend.com>                          |
16    |          Kirti Velankar <kirtig@yahoo-inc.com>   			  |
17    +----------------------------------------------------------------------+
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 
25 #include "php_intl.h"
26 #include "intl_error.h"
27 #include "collator/collator_class.h"
28 #include "collator/collator.h"
29 #include "collator/collator_attr.h"
30 #include "collator/collator_compare.h"
31 #include "collator/collator_sort.h"
32 #include "collator/collator_convert.h"
33 #include "collator/collator_locale.h"
34 #include "collator/collator_create.h"
35 #include "collator/collator_error.h"
36 
37 #include "converter/converter.h"
38 
39 #include "formatter/formatter.h"
40 #include "formatter/formatter_class.h"
41 #include "formatter/formatter_attr.h"
42 #include "formatter/formatter_format.h"
43 #include "formatter/formatter_main.h"
44 #include "formatter/formatter_parse.h"
45 
46 #include "grapheme/grapheme.h"
47 
48 #include "msgformat/msgformat.h"
49 #include "msgformat/msgformat_class.h"
50 #include "msgformat/msgformat_attr.h"
51 #include "msgformat/msgformat_format.h"
52 #include "msgformat/msgformat_parse.h"
53 
54 #include "normalizer/normalizer.h"
55 #include "normalizer/normalizer_class.h"
56 #include "normalizer/normalizer_normalize.h"
57 
58 #include "locale/locale.h"
59 #include "locale/locale_class.h"
60 #include "locale/locale_methods.h"
61 
62 #include "dateformat/dateformat.h"
63 #include "dateformat/dateformat_class.h"
64 #include "dateformat/dateformat_attr.h"
65 #include "dateformat/dateformat_attrcpp.h"
66 #include "dateformat/dateformat_format.h"
67 #include "dateformat/dateformat_format_object.h"
68 #include "dateformat/dateformat_parse.h"
69 #include "dateformat/dateformat_data.h"
70 
71 #include "resourcebundle/resourcebundle_class.h"
72 
73 #include "transliterator/transliterator.h"
74 #include "transliterator/transliterator_class.h"
75 #include "transliterator/transliterator_methods.h"
76 
77 #include "timezone/timezone_class.h"
78 #include "timezone/timezone_methods.h"
79 
80 #include "calendar/calendar_class.h"
81 #include "calendar/calendar_methods.h"
82 #include "calendar/gregoriancalendar_methods.h"
83 
84 #include "breakiterator/breakiterator_class.h"
85 #include "breakiterator/breakiterator_iterators.h"
86 
87 #include "idn/idn.h"
88 #include "uchar/uchar.h"
89 
90 #if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002
91 # include "spoofchecker/spoofchecker_class.h"
92 # include "spoofchecker/spoofchecker.h"
93 # include "spoofchecker/spoofchecker_create.h"
94 # include "spoofchecker/spoofchecker_main.h"
95 #endif
96 
97 #include "msgformat/msgformat.h"
98 #include "common/common_error.h"
99 #include "common/common_enum.h"
100 
101 #include <unicode/uloc.h>
102 #include <unicode/uclean.h>
103 #include <ext/standard/info.h>
104 
105 #include "php_ini.h"
106 #define INTL_MODULE_VERSION PHP_INTL_VERSION
107 
108 /*
109  * locale_get_default has a conflict since ICU also has
110  * a function with the same  name
111  * in fact ICU appends the version no. to it also
112  * Hence the following undef for ICU version
113  * Same true for the locale_set_default function
114 */
115 #undef locale_get_default
116 #undef locale_set_default
117 
ZEND_DECLARE_MODULE_GLOBALS(intl)118 ZEND_DECLARE_MODULE_GLOBALS( intl )
119 
120 const char *intl_locale_get_default( void )
121 {
122 	if( INTL_G(default_locale) == NULL ) {
123 		return uloc_getDefault();
124 	}
125 	return INTL_G(default_locale);
126 }
127 
128 /* {{{ Arguments info */
129 ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
130 ZEND_END_ARG_INFO()
131 
132 ZEND_BEGIN_ARG_INFO_EX(collator_static_1_arg, 0, 0, 1)
133 	ZEND_ARG_INFO(0, arg1)
134 ZEND_END_ARG_INFO()
135 
136 ZEND_BEGIN_ARG_INFO_EX(collator_static_2_args, 0, 0, 2)
137 	ZEND_ARG_INFO(0, arg1)
138 	ZEND_ARG_INFO(0, arg2)
139 ZEND_END_ARG_INFO()
140 
141 ZEND_BEGIN_ARG_INFO_EX(collator_0_args, 0, 0, 1)
142 	ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
143 ZEND_END_ARG_INFO()
144 
145 ZEND_BEGIN_ARG_INFO_EX(collator_1_arg, 0, 0, 2)
146 	ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
147 	ZEND_ARG_INFO(0, arg1)
148 ZEND_END_ARG_INFO()
149 
150 ZEND_BEGIN_ARG_INFO_EX(collator_2_args, 0, 0, 3)
151 	ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
152 	ZEND_ARG_INFO(0, arg1)
153 	ZEND_ARG_INFO(0, arg2)
154 ZEND_END_ARG_INFO()
155 
156 ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
157 	ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
158 	ZEND_ARG_ARRAY_INFO(1, arr, 0)
159 	ZEND_ARG_INFO(0, sort_flags)
160 ZEND_END_ARG_INFO()
161 
162 ZEND_BEGIN_ARG_INFO_EX(collator_sort_with_sort_keys_args, 0, 0, 2)
163 	ZEND_ARG_OBJ_INFO(0, coll, Collator, 0)
164 	ZEND_ARG_ARRAY_INFO(1, arr, 0)
165 ZEND_END_ARG_INFO()
166 
167 ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
168 	ZEND_ARG_INFO(0, formatter)
169 	ZEND_ARG_INFO(0, string)
170 	ZEND_ARG_INFO(0, type)
171 	ZEND_ARG_INFO(1, position)
172 ZEND_END_ARG_INFO()
173 
174 ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
175 	ZEND_ARG_INFO(0, formatter)
176 	ZEND_ARG_INFO(0, string)
177 	ZEND_ARG_INFO(1, currency)
178 	ZEND_ARG_INFO(1, position)
179 ZEND_END_ARG_INFO()
180 
181 ZEND_BEGIN_ARG_INFO_EX( locale_get_loc_in_loc_args, 0, ZEND_RETURN_VALUE, 1 )
182 	ZEND_ARG_INFO(0, locale)
183 	ZEND_ARG_INFO(0, in_locale)
184 ZEND_END_ARG_INFO()
185 
186 ZEND_BEGIN_ARG_INFO_EX( locale_filter_matches_args, 0, ZEND_RETURN_VALUE, 2 )
187 	ZEND_ARG_INFO(0, langtag)
188 	ZEND_ARG_INFO(0, locale)
189 	ZEND_ARG_INFO(0, canonicalize)
190 ZEND_END_ARG_INFO()
191 
192 ZEND_BEGIN_ARG_INFO_EX( locale_lookup_args, 0, ZEND_RETURN_VALUE, 2 )
193 	ZEND_ARG_INFO(0, langtag)
194 	ZEND_ARG_INFO(0, locale)
195 	ZEND_ARG_INFO(0, canonicalize)
196 	ZEND_ARG_INFO(0, def)
197 ZEND_END_ARG_INFO()
198 
199 ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
200 ZEND_END_ARG_INFO()
201 
202 ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
203 	ZEND_ARG_INFO(0, arg1)
204 ZEND_END_ARG_INFO()
205 
206 #define intl_0_args collator_static_0_args
207 #define intl_1_arg collator_static_1_arg
208 
209 ZEND_BEGIN_ARG_INFO_EX(normalizer_args, 0, 0, 1)
210 	ZEND_ARG_INFO(0, input)
211 	ZEND_ARG_INFO(0, form)
212 ZEND_END_ARG_INFO()
213 
214 ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
215 	ZEND_ARG_INFO(0, string)
216 ZEND_END_ARG_INFO()
217 
218 ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
219 	ZEND_ARG_INFO(0, haystack)
220 	ZEND_ARG_INFO(0, needle)
221 	ZEND_ARG_INFO(0, offset)
222 ZEND_END_ARG_INFO()
223 
224 ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
225 	ZEND_ARG_INFO(0, string)
226 	ZEND_ARG_INFO(0, start)
227 	ZEND_ARG_INFO(0, length)
228 ZEND_END_ARG_INFO()
229 
230 ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
231 	ZEND_ARG_INFO(0, haystack)
232 	ZEND_ARG_INFO(0, needle)
233 	ZEND_ARG_INFO(0, before_needle)
234 ZEND_END_ARG_INFO()
235 
236 ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
237 	ZEND_ARG_INFO(0, arg1)
238 	ZEND_ARG_INFO(0, arg2)
239 	ZEND_ARG_INFO(0, arg3)
240 	ZEND_ARG_INFO(0, arg4)
241 	ZEND_ARG_INFO(1, arg5)  /* 1 = pass by reference */
242 ZEND_END_ARG_INFO()
243 
244 ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
245 	ZEND_ARG_INFO(0, formatter)
246 	ZEND_ARG_INFO(0, string)
247 	ZEND_ARG_INFO(1, position)
248 ZEND_END_ARG_INFO()
249 
250 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_create, 0, 0, 2)
251 	ZEND_ARG_INFO(0, locale)
252 	ZEND_ARG_INFO(0, style)
253 	ZEND_ARG_INFO(0, pattern)
254 ZEND_END_ARG_INFO()
255 
256 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_error_code, 0, 0, 1)
257 	ZEND_ARG_INFO(0, nf)
258 ZEND_END_ARG_INFO()
259 
260 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format, 0, 0, 2)
261 	ZEND_ARG_INFO(0, nf)
262 	ZEND_ARG_INFO(0, num)
263 	ZEND_ARG_INFO(0, type)
264 ZEND_END_ARG_INFO()
265 
266 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format_currency, 0, 0, 3)
267 	ZEND_ARG_INFO(0, nf)
268 	ZEND_ARG_INFO(0, num)
269 	ZEND_ARG_INFO(0, currency)
270 ZEND_END_ARG_INFO()
271 
272 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_attribute, 0, 0, 2)
273 	ZEND_ARG_INFO(0, nf)
274 	ZEND_ARG_INFO(0, attr)
275 ZEND_END_ARG_INFO()
276 
277 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_attribute, 0, 0, 3)
278 	ZEND_ARG_INFO(0, nf)
279 	ZEND_ARG_INFO(0, attr)
280 	ZEND_ARG_INFO(0, value)
281 ZEND_END_ARG_INFO()
282 
283 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_symbol, 0, 0, 3)
284 	ZEND_ARG_INFO(0, nf)
285 	ZEND_ARG_INFO(0, attr)
286 	ZEND_ARG_INFO(0, symbol)
287 ZEND_END_ARG_INFO()
288 
289 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_pattern, 0, 0, 2)
290 	ZEND_ARG_INFO(0, nf)
291 	ZEND_ARG_INFO(0, pattern)
292 ZEND_END_ARG_INFO()
293 
294 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_locale, 0, 0, 1)
295 	ZEND_ARG_INFO(0, nf)
296 	ZEND_ARG_INFO(0, type)
297 ZEND_END_ARG_INFO()
298 
299 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_create, 0, 0, 2)
300 	ZEND_ARG_INFO(0, locale)
301 	ZEND_ARG_INFO(0, pattern)
302 ZEND_END_ARG_INFO()
303 
304 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_code, 0, 0, 1)
305 	ZEND_ARG_INFO(0, nf)
306 ZEND_END_ARG_INFO()
307 
308 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_message, 0, 0, 1)
309 	ZEND_ARG_INFO(0, coll)
310 ZEND_END_ARG_INFO()
311 
312 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format, 0, 0, 2)
313 	ZEND_ARG_INFO(0, nf)
314 	ZEND_ARG_INFO(0, args)
315 ZEND_END_ARG_INFO()
316 
317 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format_message, 0, 0, 3)
318 	ZEND_ARG_INFO(0, locale)
319 	ZEND_ARG_INFO(0, pattern)
320 	ZEND_ARG_INFO(0, args)
321 ZEND_END_ARG_INFO()
322 
323 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
324 	ZEND_ARG_INFO(0, nf)
325 	ZEND_ARG_INFO(0, source)
326 ZEND_END_ARG_INFO()
327 
328 ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_parse_message, 0, 0, 3)
329 	ZEND_ARG_INFO(0, locale)
330 	ZEND_ARG_INFO(0, pattern)
331 	ZEND_ARG_INFO(0, source)
332 ZEND_END_ARG_INFO()
333 
334 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_set_pattern, 0, 0, 2)
335 	ZEND_ARG_INFO(0, mf)
336 	ZEND_ARG_INFO(0, pattern)
337 ZEND_END_ARG_INFO()
338 
339 ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_locale, 0, 0, 1)
340 	ZEND_ARG_INFO(0, mf)
341 ZEND_END_ARG_INFO()
342 
343 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
344 	ZEND_ARG_INFO(0, mf)
345 	ZEND_ARG_INFO(0, pattern)
346 ZEND_END_ARG_INFO()
347 
348 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_timezone, 0, 0, 2)
349 	ZEND_ARG_INFO(0, mf)
350 	ZEND_ARG_INFO(0, timezone)
351 ZEND_END_ARG_INFO()
352 
353 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
354 	ZEND_ARG_INFO(0, mf)
355 	ZEND_ARG_INFO(0, calendar)
356 ZEND_END_ARG_INFO()
357 
358 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0)
359 	ZEND_ARG_INFO(0, args)
360 	ZEND_ARG_INFO(0, array)
361 ZEND_END_ARG_INFO()
362 
363 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format_object, 0, 0, 1)
364 	ZEND_ARG_INFO(0, object)
365 	ZEND_ARG_INFO(0, format)
366 	ZEND_ARG_INFO(0, locale)
367 ZEND_END_ARG_INFO()
368 
369 
370 ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3)
371 	ZEND_ARG_INFO(0, locale)
372 	ZEND_ARG_INFO(0, date_type)
373 	ZEND_ARG_INFO(0, time_type)
374 	ZEND_ARG_INFO(0, timezone_str)
375 	ZEND_ARG_INFO(0, calendar)
376 	ZEND_ARG_INFO(0, pattern)
377 ZEND_END_ARG_INFO()
378 
379 ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
380 	ZEND_ARG_INFO(0, domain)
381 	ZEND_ARG_INFO(0, option)
382 	ZEND_ARG_INFO(0, variant)
383 	ZEND_ARG_INFO(1, idn_info)
384 ZEND_END_ARG_INFO()
385 
386 ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_utf8, 0, 0, 1)
387 	ZEND_ARG_INFO(0, domain)
388 	ZEND_ARG_INFO(0, option)
389 	ZEND_ARG_INFO(0, variant)
390 	ZEND_ARG_INFO(1, idn_info)
391 ZEND_END_ARG_INFO()
392 
393 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_create_proc, 0, 0, 2 )
394 	ZEND_ARG_INFO( 0, locale )
395 	ZEND_ARG_INFO( 0, bundlename )
396 	ZEND_ARG_INFO( 0, fallback )
397 ZEND_END_ARG_INFO()
398 
399 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_proc, 0, 0, 2 )
400     ZEND_ARG_INFO( 0, bundle )
401 	ZEND_ARG_INFO( 0, index )
402 	ZEND_ARG_INFO( 0, fallback )
403 ZEND_END_ARG_INFO()
404 
405 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count_proc, 0, 0, 1 )
406   ZEND_ARG_INFO( 0, bundle )
407 ZEND_END_ARG_INFO()
408 
409 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_locales_proc, 0, 0, 1 )
410 	ZEND_ARG_INFO( 0, bundlename )
411 ZEND_END_ARG_INFO()
412 
413 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code_proc, 0, 0, 1 )
414   ZEND_ARG_INFO( 0, bundle )
415 ZEND_END_ARG_INFO()
416 
417 ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message_proc, 0, 0, 1 )
418   ZEND_ARG_INFO( 0, bundle )
419 ZEND_END_ARG_INFO()
420 
421 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_void, 0, 0, 0 )
422 ZEND_END_ARG_INFO()
423 
424 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create, 0, 0, 1 )
425 	ZEND_ARG_INFO( 0, id )
426 	ZEND_ARG_INFO( 0, direction )
427 ZEND_END_ARG_INFO()
428 
429 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create_from_rules, 0, 0, 1 )
430 	ZEND_ARG_INFO( 0, rules )
431 	ZEND_ARG_INFO( 0, direction )
432 ZEND_END_ARG_INFO()
433 
434 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create_inverse, 0, 0, 1 )
435 	ZEND_ARG_OBJ_INFO( 0, orig_trans, Transliterator, 0 )
436 ZEND_END_ARG_INFO()
437 
438 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_transliterate, 0, 0, 2 )
439 	ZEND_ARG_INFO( 0, trans )
440 	ZEND_ARG_INFO( 0, subject )
441 	ZEND_ARG_INFO( 0, start )
442 	ZEND_ARG_INFO( 0, end )
443 ZEND_END_ARG_INFO()
444 
445 ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_error, 0, 0, 1 )
446 	ZEND_ARG_OBJ_INFO( 0, trans, Transliterator, 0 )
447 ZEND_END_ARG_INFO()
448 
449 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 )
450 	ZEND_ARG_INFO( 0, zoneId )
451 ZEND_END_ARG_INFO()
452 
453 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 )
454 	ZEND_ARG_OBJ_INFO( 0, dateTimeZone, DateTimeZone, 0 )
455 ZEND_END_ARG_INFO()
456 
457 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 )
458 	ZEND_ARG_INFO( 0, countryOrRawOffset )
459 ZEND_END_ARG_INFO()
460 
461 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_count_equivalent_ids, 0, 0, 1 )
462 	ZEND_ARG_INFO( 0, zoneId )
463 ZEND_END_ARG_INFO()
464 
465 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_time_zone_id_enumeration, 0, 0, 1 )
466 	ZEND_ARG_INFO( 0, zoneType )
467 	ZEND_ARG_INFO( 0, region )
468 	ZEND_ARG_INFO( 0, rawOffset )
469 ZEND_END_ARG_INFO()
470 
471 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_canonical_id, 0, 0, 1 )
472 	ZEND_ARG_INFO( 0, zoneId )
473 	ZEND_ARG_INFO( 1, isSystemID )
474 ZEND_END_ARG_INFO()
475 
476 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_equivalent_id, 0, 0, 2 )
477 	ZEND_ARG_INFO( 0, zoneId )
478 	ZEND_ARG_INFO( 0, index )
479 ZEND_END_ARG_INFO()
480 
481 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_offset, 0, 0, 5 )
482 	ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
483 	ZEND_ARG_INFO( 0, date )
484 	ZEND_ARG_INFO( 0, local )
485 	ZEND_ARG_INFO( 1, rawOffset )
486 	ZEND_ARG_INFO( 1, dstOffset )
487 ZEND_END_ARG_INFO()
488 
489 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_has_same_rules, 0, 0, 1 )
490 	ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
491 	ZEND_ARG_OBJ_INFO( 0, otherTimeZone, IntlTimeZone, 0 )
492 ZEND_END_ARG_INFO()
493 
494 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_display_name, 0, 0, 1 )
495 	ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
496 	ZEND_ARG_INFO( 0, isDaylight )
497 	ZEND_ARG_INFO( 0, style )
498 	ZEND_ARG_INFO( 0, locale )
499 ZEND_END_ARG_INFO()
500 
501 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_only_tz, 0, 0, 1 )
502 	ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
503 ZEND_END_ARG_INFO()
504 
505 ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_void, 0, 0, 0 )
506 ZEND_END_ARG_INFO()
507 
508 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_create_instance, 0, 0, 0 )
509 	ZEND_ARG_INFO( 0, timeZone )
510 	ZEND_ARG_INFO( 0, locale )
511 ZEND_END_ARG_INFO()
512 
513 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_only_cal, 0, 0, 1 )
514 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
515 ZEND_END_ARG_INFO()
516 
517 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_void, 0, 0, 0 )
518 ZEND_END_ARG_INFO()
519 
520 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_field, 0, 0, 2 )
521 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
522 	ZEND_ARG_INFO( 0, field )
523 ZEND_END_ARG_INFO()
524 
525 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_dow, 0, 0, 2 )
526 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
527 	ZEND_ARG_INFO( 0, dayOfWeek )
528 ZEND_END_ARG_INFO()
529 
530 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_other_cal, 0, 0, 2 )
531 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
532 	ZEND_ARG_OBJ_INFO( 0, otherCalendar, IntlCalendar, 0 )
533 ZEND_END_ARG_INFO()
534 
535 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_date, 0, 0, 2 )
536 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
537 	ZEND_ARG_INFO( 0, date )
538 ZEND_END_ARG_INFO()
539 
540 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_date_optional, 0, 0, 1 )
541 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
542 	ZEND_ARG_INFO( 0, date )
543 ZEND_END_ARG_INFO()
544 
545 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_get_keyword_values_for_locale, 0, 0, 3)
546 	ZEND_ARG_INFO( 0, key )
547 	ZEND_ARG_INFO( 0, locale )
548 	ZEND_ARG_INFO( 0, commonlyUsed )
549 ZEND_END_ARG_INFO()
550 
551 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_add, 0, 0, 3 )
552 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
553 	ZEND_ARG_INFO( 0, field )
554 	ZEND_ARG_INFO( 0, amount )
555 ZEND_END_ARG_INFO()
556 
557 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_time_zone, 0, 0, 2 )
558 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
559 	ZEND_ARG_INFO( 0, timeZone )
560 ZEND_END_ARG_INFO()
561 
562 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set, 0, 0, 3 )
563 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
564 	ZEND_ARG_INFO( 0, fieldOrYear )
565 	ZEND_ARG_INFO( 0, valueOrMonth )
566 	ZEND_ARG_INFO( 0, dayOfMonth )
567 	ZEND_ARG_INFO( 0, hour )
568 	ZEND_ARG_INFO( 0, minute )
569 	ZEND_ARG_INFO( 0, second )
570 ZEND_END_ARG_INFO()
571 
572 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_roll, 0, 0, 2 )
573 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
574 	ZEND_ARG_INFO( 0, field )
575 	ZEND_ARG_INFO( 0, amountOrUpOrDown )
576 ZEND_END_ARG_INFO()
577 
578 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_clear, 0, 0, 1 )
579 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
580 	ZEND_ARG_INFO( 0, field )
581 ZEND_END_ARG_INFO()
582 
583 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_field_difference, 0, 0, 3 )
584 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
585 	ZEND_ARG_INFO( 0, when )
586 	ZEND_ARG_INFO( 0, field )
587 ZEND_END_ARG_INFO()
588 
589 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_get_locale, 0, 0, 2 )
590 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
591 	ZEND_ARG_INFO( 0, localeType )
592 ZEND_END_ARG_INFO()
593 
594 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_lenient, 0, 0, 2 )
595 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
596 	ZEND_ARG_INFO( 0, isLenient )
597 ZEND_END_ARG_INFO()
598 
599 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_minimal_days_in_first_week, 0, 0, 2 )
600 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
601 	ZEND_ARG_INFO( 0, numberOfDays )
602 ZEND_END_ARG_INFO()
603 
604 ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1)
605 	ZEND_ARG_INFO(0, dateTime)
606 ZEND_END_ARG_INFO()
607 
608 ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_wall_time_option, 0, 0, 2 )
609 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
610 	ZEND_ARG_INFO( 0, wallTimeOption )
611 ZEND_END_ARG_INFO()
612 
613 /* Gregorian Calendar */
614 ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_create_instance, 0, 0, 0 )
615 	ZEND_ARG_INFO(0, timeZoneOrYear)
616 	ZEND_ARG_INFO(0, localeOrMonth)
617 	ZEND_ARG_INFO(0, dayOfMonth)
618 	ZEND_ARG_INFO(0, hour)
619 	ZEND_ARG_INFO(0, minute)
620 	ZEND_ARG_INFO(0, second)
621 ZEND_END_ARG_INFO()
622 
623 ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_is_leap_year, 0, 0, 2 )
624 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
625 	ZEND_ARG_INFO( 0, year )
626 ZEND_END_ARG_INFO()
627 
628 ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_only_gregcal, 0, 0, 1 )
629 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
630 ZEND_END_ARG_INFO()
631 
632 ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_set_gregorian_change, 0, 0, 2 )
633 	ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
634 	ZEND_ARG_INFO( 0, date )
635 ZEND_END_ARG_INFO()
636 
637 /* }}} */
638 
639 /* {{{ intl_functions
640  *
641  * Every user visible function must have an entry in intl_functions[].
642  */
643 zend_function_entry intl_functions[] = {
644 
645 	/* collator functions */
646 	PHP_FE( collator_create, collator_static_1_arg )
647 	PHP_FE( collator_compare, collator_2_args )
648 	PHP_FE( collator_get_attribute, collator_1_arg )
649 	PHP_FE( collator_set_attribute, collator_2_args )
650 	PHP_FE( collator_get_strength, collator_0_args )
651 	PHP_FE( collator_set_strength, collator_1_arg )
652 	PHP_FE( collator_sort, collator_sort_args )
653 	PHP_FE( collator_sort_with_sort_keys, collator_sort_with_sort_keys_args )
654 	PHP_FE( collator_asort, collator_sort_args )
655 	PHP_FE( collator_get_locale, collator_1_arg )
656 	PHP_FE( collator_get_error_code, collator_0_args )
657 	PHP_FE( collator_get_error_message, collator_0_args )
658 	PHP_FE( collator_get_sort_key, collator_1_arg )
659 
660 	/* formatter functions */
661 	PHP_FE( numfmt_create, arginfo_numfmt_create )
662 	PHP_FE( numfmt_format, arginfo_numfmt_format )
663 	PHP_FE( numfmt_parse, numfmt_parse_arginfo )
664 	PHP_FE( numfmt_format_currency, arginfo_numfmt_format_currency )
665 	PHP_FE( numfmt_parse_currency, numfmt_parse_currency_arginfo )
666 	PHP_FE( numfmt_set_attribute, arginfo_numfmt_set_attribute )
667 	PHP_FE( numfmt_get_attribute, arginfo_numfmt_get_attribute )
668 	PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_attribute )
669 	PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_attribute )
670 	PHP_FE( numfmt_set_symbol, arginfo_numfmt_set_symbol )
671 	PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_attribute )
672 	PHP_FE( numfmt_set_pattern, arginfo_numfmt_set_pattern )
673 	PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_error_code )
674 	PHP_FE( numfmt_get_locale, arginfo_numfmt_get_locale )
675 	PHP_FE( numfmt_get_error_code, arginfo_numfmt_get_error_code )
676 	PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_code )
677 
678 	/* normalizer functions */
679 	PHP_FE( normalizer_normalize, normalizer_args )
680 	PHP_FE( normalizer_is_normalized, normalizer_args )
681 
682 	/* Locale functions */
683 	PHP_NAMED_FE( locale_get_default, zif_locale_get_default, locale_0_args )
684 	PHP_NAMED_FE( locale_set_default, zif_locale_set_default, locale_1_arg )
685 	PHP_FE( locale_get_primary_language, locale_1_arg )
686 	PHP_FE( locale_get_script, locale_1_arg )
687 	PHP_FE( locale_get_region, locale_1_arg )
688 	PHP_FE( locale_get_keywords, locale_1_arg )
689 	PHP_FE( locale_get_display_script, locale_get_loc_in_loc_args )
690 	PHP_FE( locale_get_display_region, locale_get_loc_in_loc_args )
691 	PHP_FE( locale_get_display_name, locale_get_loc_in_loc_args )
692 	PHP_FE( locale_get_display_language, locale_get_loc_in_loc_args)
693 	PHP_FE( locale_get_display_variant, locale_get_loc_in_loc_args )
694 	PHP_FE( locale_compose, locale_1_arg )
695 	PHP_FE( locale_parse, locale_1_arg )
696 	PHP_FE( locale_get_all_variants, locale_1_arg )
697 	PHP_FE( locale_filter_matches, locale_filter_matches_args )
698 	PHP_FE( locale_canonicalize, locale_1_arg )
699 	PHP_FE( locale_lookup, locale_lookup_args )
700 	PHP_FE( locale_accept_from_http, locale_1_arg )
701 
702 	/* MessageFormatter functions */
703 	PHP_FE( msgfmt_create, arginfo_msgfmt_create )
704 	PHP_FE( msgfmt_format, arginfo_msgfmt_format )
705 	PHP_FE( msgfmt_format_message, arginfo_msgfmt_format_message )
706 	PHP_FE( msgfmt_parse, arginfo_msgfmt_parse )
707 	PHP_FE( msgfmt_parse_message, arginfo_numfmt_parse_message )
708 	PHP_FE( msgfmt_set_pattern, arginfo_msgfmt_set_pattern )
709 	PHP_FE( msgfmt_get_pattern, arginfo_msgfmt_get_locale )
710 	PHP_FE( msgfmt_get_locale, arginfo_msgfmt_get_locale )
711 	PHP_FE( msgfmt_get_error_code, arginfo_msgfmt_get_error_code )
712 	PHP_FE( msgfmt_get_error_message, arginfo_msgfmt_get_error_message )
713 
714 	/* IntlDateFormatter functions */
715 	PHP_FE( datefmt_create, arginfo_datefmt_create )
716 	PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale )
717 	PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale )
718 	PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale )
719 	PHP_FE( datefmt_get_calendar_object, arginfo_msgfmt_get_locale )
720 	PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar )
721 	PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale )
722 	PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale )
723 	PHP_FE( datefmt_get_timezone, arginfo_msgfmt_get_locale )
724 	PHP_FE( datefmt_set_timezone, arginfo_datefmt_set_timezone )
725 	PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale )
726 	PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern )
727 	PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale )
728 	PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale )
729 	PHP_FE( datefmt_format, arginfo_datefmt_format )
730 	PHP_FE( datefmt_format_object, arginfo_datefmt_format_object )
731 	PHP_FE( datefmt_parse, datefmt_parse_args )
732 	PHP_FE( datefmt_localtime , datefmt_parse_args )
733 	PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code )
734 	PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
735 
736 	/* grapheme functions */
737 	PHP_FE( grapheme_strlen, grapheme_1_arg )
738 	PHP_FE( grapheme_strpos, grapheme_search_args )
739 	PHP_FE( grapheme_stripos, grapheme_search_args )
740 	PHP_FE( grapheme_strrpos, grapheme_search_args )
741 	PHP_FE( grapheme_strripos, grapheme_search_args )
742 	PHP_FE( grapheme_substr, grapheme_substr_args )
743 	PHP_FE( grapheme_strstr, grapheme_strstr_args )
744 	PHP_FE( grapheme_stristr, grapheme_strstr_args )
745 	PHP_FE( grapheme_extract, grapheme_extract_args )
746 
747 	/* IDN functions */
748 	PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)
749 	PHP_FE( idn_to_utf8, arginfo_idn_to_ascii)
750 
751 	/* ResourceBundle functions */
752 	PHP_FE( resourcebundle_create, arginfo_resourcebundle_create_proc )
753 	PHP_FE( resourcebundle_get, arginfo_resourcebundle_get_proc )
754 	PHP_FE( resourcebundle_count, arginfo_resourcebundle_count_proc )
755 	PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc )
756 	PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc )
757 	PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc )
758 
759 	/* Transliterator functions */
760 	PHP_FE( transliterator_create, arginfo_transliterator_create )
761 	PHP_FE( transliterator_create_from_rules, arginfo_transliterator_create_from_rules )
762 	PHP_FE( transliterator_list_ids, arginfo_transliterator_void )
763 	PHP_FE( transliterator_create_inverse, arginfo_transliterator_create_inverse)
764 	PHP_FE( transliterator_transliterate, arginfo_transliterator_transliterate )
765 	PHP_FE( transliterator_get_error_code, arginfo_transliterator_error )
766 	PHP_FE( transliterator_get_error_message, arginfo_transliterator_error )
767 
768 	/* TimeZone functions */
769 	PHP_FE( intltz_create_time_zone, arginfo_tz_idarg_static )
770 	PHP_FE( intltz_from_date_time_zone, arginfo_tz_from_date_time_zone )
771 	PHP_FE( intltz_create_default, arginfo_tz_void )
772 	PHP_FE( intltz_get_id, arginfo_tz_only_tz )
773 	PHP_FE( intltz_get_gmt, arginfo_tz_void )
774 #if U_ICU_VERSION_MAJOR_NUM >= 49
775 	PHP_FE( intltz_get_unknown, arginfo_tz_void )
776 #endif
777 	PHP_FE( intltz_create_enumeration, arginfo_tz_create_enumeration )
778 	PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static )
779 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
780 	PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration )
781 #endif
782 	PHP_FE( intltz_get_canonical_id, arginfo_tz_get_canonical_id )
783 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
784 	PHP_FE( intltz_get_region, arginfo_tz_idarg_static )
785 #endif
786 	PHP_FE( intltz_get_tz_data_version, arginfo_tz_void )
787 	PHP_FE( intltz_get_equivalent_id, arginfo_tz_get_equivalent_id )
788 	PHP_FE( intltz_use_daylight_time, arginfo_tz_only_tz )
789 	PHP_FE( intltz_get_offset, arginfo_tz_get_offset )
790 	PHP_FE( intltz_get_raw_offset, arginfo_tz_only_tz )
791 	PHP_FE( intltz_has_same_rules, arginfo_tz_has_same_rules )
792 	PHP_FE( intltz_get_display_name, arginfo_tz_get_display_name )
793 	PHP_FE( intltz_get_dst_savings, arginfo_tz_only_tz )
794 	PHP_FE( intltz_to_date_time_zone, arginfo_tz_only_tz )
795 	PHP_FE( intltz_get_error_code, arginfo_tz_only_tz )
796 	PHP_FE( intltz_get_error_message, arginfo_tz_only_tz )
797 
798 	PHP_FE( intlcal_create_instance, ainfo_cal_create_instance )
799 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 42
800 	PHP_FE( intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale )
801 #endif
802 	PHP_FE( intlcal_get_now, ainfo_cal_void )
803 	PHP_FE( intlcal_get_available_locales, ainfo_cal_void )
804 	PHP_FE( intlcal_get, ainfo_cal_field )
805 	PHP_FE( intlcal_get_time, ainfo_cal_only_cal )
806 	PHP_FE( intlcal_set_time, ainfo_cal_date )
807 	PHP_FE( intlcal_add, ainfo_cal_add )
808 	PHP_FE( intlcal_set_time_zone, ainfo_cal_set_time_zone )
809 	PHP_FE( intlcal_after, ainfo_cal_other_cal )
810 	PHP_FE( intlcal_before, ainfo_cal_other_cal )
811 	PHP_FE( intlcal_set, ainfo_cal_set )
812 	PHP_FE( intlcal_roll, ainfo_cal_roll )
813 	PHP_FE( intlcal_clear, ainfo_cal_clear )
814 	PHP_FE( intlcal_field_difference, ainfo_cal_field_difference )
815 	PHP_FE( intlcal_get_actual_maximum, ainfo_cal_field )
816 	PHP_FE( intlcal_get_actual_minimum, ainfo_cal_field )
817 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
818 	PHP_FE( intlcal_get_day_of_week_type, ainfo_cal_dow )
819 #endif
820 	PHP_FE( intlcal_get_first_day_of_week, ainfo_cal_only_cal )
821 	PHP_FE( intlcal_get_greatest_minimum, ainfo_cal_field )
822 	PHP_FE( intlcal_get_least_maximum, ainfo_cal_field )
823 	PHP_FE( intlcal_get_locale, ainfo_cal_get_locale )
824 	PHP_FE( intlcal_get_maximum, ainfo_cal_field )
825 	PHP_FE( intlcal_get_minimal_days_in_first_week, ainfo_cal_only_cal )
826 	PHP_FE( intlcal_get_minimum, ainfo_cal_field )
827 	PHP_FE( intlcal_get_time_zone, ainfo_cal_only_cal )
828 	PHP_FE( intlcal_get_type, ainfo_cal_only_cal )
829 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
830 	PHP_FE( intlcal_get_weekend_transition, ainfo_cal_dow )
831 #endif
832 	PHP_FE( intlcal_in_daylight_time, ainfo_cal_only_cal )
833 	PHP_FE( intlcal_is_equivalent_to, ainfo_cal_other_cal )
834 	PHP_FE( intlcal_is_lenient, ainfo_cal_only_cal )
835 	PHP_FE( intlcal_is_set, ainfo_cal_field )
836 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
837 	PHP_FE( intlcal_is_weekend, ainfo_cal_date_optional )
838 #endif
839 	PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow )
840 	PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient )
841 	PHP_FE( intlcal_set_minimal_days_in_first_week, ainfo_cal_set_minimal_days_in_first_week )
842 	PHP_FE( intlcal_equals, ainfo_cal_other_cal )
843 	PHP_FE( intlcal_from_date_time, ainfo_cal_from_date_time )
844 	PHP_FE( intlcal_to_date_time, ainfo_cal_only_cal )
845 #if U_ICU_VERSION_MAJOR_NUM >= 49
846 	PHP_FE( intlcal_get_repeated_wall_time_option, ainfo_cal_only_cal )
847 	PHP_FE( intlcal_get_skipped_wall_time_option, ainfo_cal_only_cal )
848 	PHP_FE( intlcal_set_repeated_wall_time_option, ainfo_cal_wall_time_option )
849 	PHP_FE( intlcal_set_skipped_wall_time_option, ainfo_cal_wall_time_option )
850 #endif
851 	PHP_FE( intlcal_get_error_code, ainfo_cal_only_cal )
852 	PHP_FE( intlcal_get_error_message, ainfo_cal_only_cal )
853 
854 	PHP_FE( intlgregcal_create_instance, ainfo_gregcal_create_instance )
855 	PHP_FE( intlgregcal_set_gregorian_change, ainfo_gregcal_set_gregorian_change )
856 	PHP_FE( intlgregcal_get_gregorian_change, ainfo_gregcal_only_gregcal )
857 	PHP_FE( intlgregcal_is_leap_year, ainfo_gregcal_is_leap_year )
858 
859 	/* common functions */
860 	PHP_FE( intl_get_error_code, intl_0_args )
861 	PHP_FE( intl_get_error_message, intl_0_args )
862 	PHP_FE( intl_is_failure, intl_1_arg )
863 	PHP_FE( intl_error_name, intl_1_arg )
864 
865 	PHP_FE_END
866 };
867 /* }}} */
868 
869 /* {{{ INI Settings */
870 PHP_INI_BEGIN()
871     STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
872     STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
873 	STD_PHP_INI_ENTRY("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool, use_exceptions, zend_intl_globals, intl_globals)
874 PHP_INI_END()
875 /* }}} */
876 
877 static PHP_GINIT_FUNCTION(intl);
878 
879 /* {{{ intl_module_entry */
880 zend_module_entry intl_module_entry = {
881 	STANDARD_MODULE_HEADER,
882 	"intl",
883 	intl_functions,
884 	PHP_MINIT( intl ),
885 	PHP_MSHUTDOWN( intl ),
886 	PHP_RINIT( intl ),
887 	PHP_RSHUTDOWN( intl ),
888 	PHP_MINFO( intl ),
889 	INTL_MODULE_VERSION,
890 	PHP_MODULE_GLOBALS(intl),   /* globals descriptor */
891 	PHP_GINIT(intl),            /* globals ctor */
892 	NULL,                       /* globals dtor */
893 	NULL,                       /* post deactivate */
894 	STANDARD_MODULE_PROPERTIES_EX
895 };
896 /* }}} */
897 
898 #ifdef COMPILE_DL_INTL
899 #ifdef ZTS
900 ZEND_TSRMLS_CACHE_DEFINE()
901 #endif
ZEND_GET_MODULE(intl)902 ZEND_GET_MODULE( intl )
903 #endif
904 
905 /* {{{ intl_init_globals */
906 static PHP_GINIT_FUNCTION(intl)
907 {
908 #if defined(COMPILE_DL_INTL) && defined(ZTS)
909 	ZEND_TSRMLS_CACHE_UPDATE();
910 #endif
911 	memset( intl_globals, 0, sizeof(zend_intl_globals) );
912 }
913 /* }}} */
914 
915 /* {{{ PHP_MINIT_FUNCTION
916  */
PHP_MINIT_FUNCTION(intl)917 PHP_MINIT_FUNCTION( intl )
918 {
919 	/* For the default locale php.ini setting */
920 	REGISTER_INI_ENTRIES();
921 
922 	REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS);
923 	REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
924 #ifdef U_ICU_DATA_VERSION
925 	REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
926 #endif
927 
928 	/* Register 'Collator' PHP class */
929 	collator_register_Collator_class(  );
930 
931 	/* Expose Collator constants to PHP scripts */
932 	collator_register_constants( INIT_FUNC_ARGS_PASSTHRU );
933 
934 	/* Register 'NumberFormatter' PHP class */
935 	formatter_register_class(  );
936 
937 	/* Expose NumberFormatter constants to PHP scripts */
938 	formatter_register_constants( INIT_FUNC_ARGS_PASSTHRU );
939 
940 	/* Register 'Normalizer' PHP class */
941 	normalizer_register_Normalizer_class(  );
942 
943 	/* Expose Normalizer constants to PHP scripts */
944 	normalizer_register_constants( INIT_FUNC_ARGS_PASSTHRU );
945 
946 	/* Register 'Locale' PHP class */
947 	locale_register_Locale_class(  );
948 
949 	/* Expose Locale constants to PHP scripts */
950 	locale_register_constants( INIT_FUNC_ARGS_PASSTHRU );
951 
952 	msgformat_register_class();
953 
954 	grapheme_register_constants( INIT_FUNC_ARGS_PASSTHRU );
955 
956 	/* Register 'DateFormat' PHP class */
957 	dateformat_register_IntlDateFormatter_class(  );
958 
959 	/* Expose DateFormat constants to PHP scripts */
960 	dateformat_register_constants( INIT_FUNC_ARGS_PASSTHRU );
961 
962 	/* Register 'ResourceBundle' PHP class */
963 	resourcebundle_register_class( );
964 
965 	/* Register 'Transliterator' PHP class */
966 	transliterator_register_Transliterator_class(  );
967 
968 	/* Register Transliterator constants */
969 	transliterator_register_constants( INIT_FUNC_ARGS_PASSTHRU );
970 
971 	/* Register 'IntlTimeZone' PHP class */
972 	timezone_register_IntlTimeZone_class(  );
973 
974 	/* Register 'IntlCalendar' PHP class */
975 	calendar_register_IntlCalendar_class(  );
976 
977 	/* Expose ICU error codes to PHP scripts. */
978 	intl_expose_icu_error_codes( INIT_FUNC_ARGS_PASSTHRU );
979 
980 	/* Expose IDN constants to PHP scripts. */
981 	idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
982 
983 #if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002
984 	/* Register 'Spoofchecker' PHP class */
985 	spoofchecker_register_Spoofchecker_class(  );
986 
987 	/* Expose Spoofchecker constants to PHP scripts */
988 	spoofchecker_register_constants( INIT_FUNC_ARGS_PASSTHRU );
989 #endif
990 
991 	/* Register 'IntlException' PHP class */
992 	intl_register_IntlException_class(  );
993 
994 	/* Register 'IntlIterator' PHP class */
995 	intl_register_IntlIterator_class(  );
996 
997 	/* Register 'BreakIterator' class */
998 	breakiterator_register_BreakIterator_class(  );
999 
1000 	/* Register 'IntlPartsIterator' class */
1001 	breakiterator_register_IntlPartsIterator_class(  );
1002 
1003 	/* Global error handling. */
1004 	intl_error_init( NULL );
1005 
1006 	/* 'Converter' class for codepage conversions */
1007 	php_converter_minit(INIT_FUNC_ARGS_PASSTHRU);
1008 
1009 	/* IntlChar class */
1010 	php_uchar_minit(INIT_FUNC_ARGS_PASSTHRU);
1011 
1012 	return SUCCESS;
1013 }
1014 /* }}} */
1015 
1016 #define EXPLICIT_CLEANUP_ENV_VAR "INTL_EXPLICIT_CLEANUP"
1017 
1018 /* {{{ PHP_MSHUTDOWN_FUNCTION
1019  */
PHP_MSHUTDOWN_FUNCTION(intl)1020 PHP_MSHUTDOWN_FUNCTION( intl )
1021 {
1022 	const char *cleanup;
1023     /* For the default locale php.ini setting */
1024     UNREGISTER_INI_ENTRIES();
1025 
1026 	cleanup = getenv(EXPLICIT_CLEANUP_ENV_VAR);
1027     if (cleanup != NULL && !(cleanup[0] == '0' && cleanup[1] == '\0')) {
1028 		u_cleanup();
1029     }
1030 
1031     return SUCCESS;
1032 }
1033 /* }}} */
1034 
1035 /* {{{ PHP_RINIT_FUNCTION
1036  */
PHP_RINIT_FUNCTION(intl)1037 PHP_RINIT_FUNCTION( intl )
1038 {
1039 	return SUCCESS;
1040 }
1041 /* }}} */
1042 
1043 /* {{{ PHP_RSHUTDOWN_FUNCTION
1044  */
PHP_RSHUTDOWN_FUNCTION(intl)1045 PHP_RSHUTDOWN_FUNCTION( intl )
1046 {
1047 	if(!Z_ISUNDEF(INTL_G(current_collator))) {
1048 		ZVAL_UNDEF(&INTL_G(current_collator));
1049 	}
1050 	if (INTL_G(grapheme_iterator)) {
1051 		grapheme_close_global_iterator(  );
1052 		INTL_G(grapheme_iterator) = NULL;
1053 	}
1054 
1055 	intl_error_reset( NULL);
1056 	return SUCCESS;
1057 }
1058 /* }}} */
1059 
1060 /* {{{ PHP_MINFO_FUNCTION
1061  */
PHP_MINFO_FUNCTION(intl)1062 PHP_MINFO_FUNCTION( intl )
1063 {
1064 	php_info_print_table_start();
1065 	php_info_print_table_header( 2, "Internationalization support", "enabled" );
1066 	php_info_print_table_row( 2, "version", INTL_MODULE_VERSION );
1067 	php_info_print_table_row( 2, "ICU version", U_ICU_VERSION );
1068 #ifdef U_ICU_DATA_VERSION
1069 	php_info_print_table_row( 2, "ICU Data version", U_ICU_DATA_VERSION );
1070 #endif
1071 	php_info_print_table_end();
1072 
1073     /* For the default locale php.ini setting */
1074     DISPLAY_INI_ENTRIES() ;
1075 }
1076 /* }}} */
1077 
1078 /*
1079  * Local variables:
1080  * tab-width: 4
1081  * c-basic-offset: 4
1082  * End:
1083  * vim600: noet sw=4 ts=4 fdm=marker
1084  * vim<600: noet sw=4 ts=4
1085  */
1086