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