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