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: Gustavo Lopes <cataphract@php.net> |
14 +----------------------------------------------------------------------+
15 */
16
17
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21
22 #include "../intl_cppshims.h"
23
24 #include <unicode/timezone.h>
25 #include <unicode/calendar.h>
26 #include "../intl_convertcpp.h"
27
28 #include "../common/common_date.h"
29
30 extern "C" {
31 #include "../intl_convert.h"
32 #define USE_TIMEZONE_POINTER 1
33 #include "timezone_class.h"
34 #include "timezone_methods.h"
35 #include <zend_exceptions.h>
36 #include <zend_interfaces.h>
37 #include <ext/date/php_date.h>
38 }
39
40 using icu::Calendar;
41
42 /* {{{ Global variables */
43 U_CDECL_BEGIN
44 zend_class_entry *TimeZone_ce_ptr = NULL;
45 zend_object_handlers TimeZone_handlers;
46 U_CDECL_END
47 /* }}} */
48
49 /* {{{ timezone_object_construct */
timezone_object_construct(const TimeZone * zone,zval * object,int owned)50 U_CFUNC void timezone_object_construct(const TimeZone *zone, zval *object, int owned)
51 {
52 TimeZone_object *to;
53
54 object_init_ex(object, TimeZone_ce_ptr);
55 TIMEZONE_METHOD_FETCH_OBJECT_NO_CHECK; /* fetch zend object from zval "object" into "to" */
56 to->utimezone = zone;
57 to->should_delete = owned;
58 }
59 /* }}} */
60
61 /* {{{ timezone_convert_to_datetimezone
62 * Convert from TimeZone to DateTimeZone object */
timezone_convert_to_datetimezone(const TimeZone * timeZone,intl_error * outside_error,const char * func,zval * ret)63 U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
64 intl_error *outside_error,
65 const char *func, zval *ret)
66 {
67 UnicodeString id;
68 char *message = NULL;
69 php_timezone_obj *tzobj;
70 zval arg;
71
72 timeZone->getID(id);
73 if (id.isBogus()) {
74 spprintf(&message, 0, "%s: could not obtain TimeZone id", func);
75 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR,
76 message, 1);
77 goto error;
78 }
79
80 object_init_ex(ret, php_date_get_timezone_ce());
81 tzobj = Z_PHPTIMEZONE_P(ret);
82
83 if (id.compare(0, 3, UnicodeString("GMT", sizeof("GMT")-1, US_INV)) == 0) {
84 /* The DateTimeZone constructor doesn't support offset time zones,
85 * so we must mess with DateTimeZone structure ourselves */
86 tzobj->initialized = 1;
87 tzobj->type = TIMELIB_ZONETYPE_OFFSET;
88 //convert offset from milliseconds to seconds
89 tzobj->tzi.utc_offset = timeZone->getRawOffset() / 1000;
90 } else {
91 zend_string *u8str;
92 /* Call the constructor! */
93 u8str = intl_charFromString(id, &INTL_ERROR_CODE(*outside_error));
94 if (!u8str) {
95 spprintf(&message, 0, "%s: could not convert id to UTF-8", func);
96 intl_errors_set(outside_error, INTL_ERROR_CODE(*outside_error),
97 message, 1);
98 goto error;
99 }
100 ZVAL_STR(&arg, u8str);
101 zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
102 if (EG(exception)) {
103 spprintf(&message, 0,
104 "%s: DateTimeZone constructor threw exception", func);
105 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR,
106 message, 1);
107 zend_object_store_ctor_failed(Z_OBJ_P(ret));
108 zval_ptr_dtor(&arg);
109 goto error;
110 }
111 zval_ptr_dtor(&arg);
112 }
113
114 if (0) {
115 error:
116 if (ret) {
117 zval_ptr_dtor(ret);
118 }
119 ret = NULL;
120 }
121
122 if (message) {
123 efree(message);
124 }
125 return ret;
126 }
127 /* }}} */
128
129 /* {{{ timezone_process_timezone_argument
130 * TimeZone argument processor. outside_error may be NULL (for static functions/constructors) */
timezone_process_timezone_argument(zval * zv_timezone,intl_error * outside_error,const char * func)131 U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
132 intl_error *outside_error,
133 const char *func)
134 {
135 zval local_zv_tz;
136 char *message = NULL;
137 TimeZone *timeZone;
138
139 if (zv_timezone == NULL || Z_TYPE_P(zv_timezone) == IS_NULL) {
140 timelib_tzinfo *tzinfo = get_timezone_info();
141 ZVAL_STRING(&local_zv_tz, tzinfo->name);
142 zv_timezone = &local_zv_tz;
143 } else {
144 ZVAL_NULL(&local_zv_tz);
145 }
146
147 if (Z_TYPE_P(zv_timezone) == IS_OBJECT &&
148 instanceof_function(Z_OBJCE_P(zv_timezone), TimeZone_ce_ptr)) {
149 TimeZone_object *to = Z_INTL_TIMEZONE_P(zv_timezone);
150 if (to->utimezone == NULL) {
151 spprintf(&message, 0, "%s: passed IntlTimeZone is not "
152 "properly constructed", func);
153 if (message) {
154 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
155 efree(message);
156 }
157 zval_ptr_dtor_str(&local_zv_tz);
158 return NULL;
159 }
160 timeZone = to->utimezone->clone();
161 if (timeZone == NULL) {
162 spprintf(&message, 0, "%s: could not clone TimeZone", func);
163 if (message) {
164 intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1);
165 efree(message);
166 }
167 zval_ptr_dtor_str(&local_zv_tz);
168 return NULL;
169 }
170 } else if (Z_TYPE_P(zv_timezone) == IS_OBJECT &&
171 instanceof_function(Z_OBJCE_P(zv_timezone), php_date_get_timezone_ce())) {
172
173 php_timezone_obj *tzobj = Z_PHPTIMEZONE_P(zv_timezone);
174
175 zval_ptr_dtor_str(&local_zv_tz);
176 return timezone_convert_datetimezone(tzobj->type, tzobj, 0,
177 outside_error, func);
178 } else {
179 UnicodeString id;
180 UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */
181 if (!try_convert_to_string(zv_timezone)) {
182 zval_ptr_dtor_str(&local_zv_tz);
183 return NULL;
184 }
185 if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone),
186 &status) == FAILURE) {
187 spprintf(&message, 0, "%s: Time zone identifier given is not a "
188 "valid UTF-8 string", func);
189 if (message) {
190 intl_errors_set(outside_error, status, message, 1);
191 efree(message);
192 }
193 zval_ptr_dtor_str(&local_zv_tz);
194 return NULL;
195 }
196 timeZone = TimeZone::createTimeZone(id);
197 if (timeZone == NULL) {
198 spprintf(&message, 0, "%s: could not create time zone", func);
199 if (message) {
200 intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1);
201 efree(message);
202 }
203 zval_ptr_dtor_str(&local_zv_tz);
204 return NULL;
205 }
206 if (*timeZone == TimeZone::getUnknown()) {
207 spprintf(&message, 0, "%s: no such time zone: '%s'",
208 func, Z_STRVAL_P(zv_timezone));
209 if (message) {
210 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
211 efree(message);
212 }
213 zval_ptr_dtor_str(&local_zv_tz);
214 delete timeZone;
215 return NULL;
216 }
217 }
218
219 zval_ptr_dtor_str(&local_zv_tz);
220
221 return timeZone;
222 }
223 /* }}} */
224
225 /* {{{ clone handler for TimeZone */
TimeZone_clone_obj(zval * object)226 static zend_object *TimeZone_clone_obj(zval *object)
227 {
228 TimeZone_object *to_orig,
229 *to_new;
230 zend_object *ret_val;
231 intl_error_reset(NULL);
232
233 to_orig = Z_INTL_TIMEZONE_P(object);
234 intl_error_reset(TIMEZONE_ERROR_P(to_orig));
235
236 ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object));
237 to_new = php_intl_timezone_fetch_object(ret_val);
238
239 zend_objects_clone_members(&to_new->zo, &to_orig->zo);
240
241 if (to_orig->utimezone != NULL) {
242 TimeZone *newTimeZone;
243
244 newTimeZone = to_orig->utimezone->clone();
245 to_new->should_delete = 1;
246 if (!newTimeZone) {
247 zend_string *err_msg;
248 intl_errors_set_code(TIMEZONE_ERROR_P(to_orig),
249 U_MEMORY_ALLOCATION_ERROR);
250 intl_errors_set_custom_msg(TIMEZONE_ERROR_P(to_orig),
251 "Could not clone IntlTimeZone", 0);
252 err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig));
253 zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
254 zend_string_free(err_msg);
255 } else {
256 to_new->utimezone = newTimeZone;
257 }
258 } else {
259 zend_throw_exception(NULL, "Cannot clone unconstructed IntlTimeZone", 0);
260 }
261
262 return ret_val;
263 }
264 /* }}} */
265
266 /* {{{ compare_objects handler for TimeZone
267 * Can't be used for >, >=, <, <= comparisons */
TimeZone_compare_objects(zval * object1,zval * object2)268 static int TimeZone_compare_objects(zval *object1, zval *object2)
269 {
270 TimeZone_object *to1,
271 *to2;
272 to1 = Z_INTL_TIMEZONE_P(object1);
273 to2 = Z_INTL_TIMEZONE_P(object2);
274
275 if (to1->utimezone == NULL || to2->utimezone == NULL) {
276 zend_throw_exception(NULL, "Comparison with at least one unconstructed "
277 "IntlTimeZone operand", 0);
278 /* intentionally not returning */
279 } else {
280 if (*to1->utimezone == *to2->utimezone) {
281 return 0;
282 }
283 }
284
285 return 1;
286 }
287 /* }}} */
288
289 /* {{{ get_debug_info handler for TimeZone */
TimeZone_get_debug_info(zval * object,int * is_temp)290 static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
291 {
292 zval zv;
293 TimeZone_object *to;
294 const TimeZone *tz;
295 UnicodeString ustr;
296 zend_string *u8str;
297 HashTable *debug_info;
298 UErrorCode uec = U_ZERO_ERROR;
299
300 *is_temp = 1;
301
302 debug_info = zend_new_array(8);
303
304 to = Z_INTL_TIMEZONE_P(object);
305 tz = to->utimezone;
306
307 if (tz == NULL) {
308 ZVAL_FALSE(&zv);
309 zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
310 return debug_info;
311 }
312
313 ZVAL_TRUE(&zv);
314 zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
315
316 tz->getID(ustr);
317 u8str = intl_convert_utf16_to_utf8(
318 ustr.getBuffer(), ustr.length(), &uec);
319 if (!u8str) {
320 return debug_info;
321 }
322 ZVAL_NEW_STR(&zv, u8str);
323 zend_hash_str_update(debug_info, "id", sizeof("id") - 1, &zv);
324
325 int32_t rawOffset, dstOffset;
326 UDate now = Calendar::getNow();
327 tz->getOffset(now, FALSE, rawOffset, dstOffset, uec);
328 if (U_FAILURE(uec)) {
329 return debug_info;
330 }
331
332 ZVAL_LONG(&zv, (zend_long)rawOffset);
333 zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv);
334 ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset));
335 zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv);
336
337 return debug_info;
338 }
339 /* }}} */
340
341 /* {{{ void TimeZone_object_init(TimeZone_object* to)
342 * Initialize internals of TImeZone_object not specific to zend standard objects.
343 */
TimeZone_object_init(TimeZone_object * to)344 static void TimeZone_object_init(TimeZone_object *to)
345 {
346 intl_error_init(TIMEZONE_ERROR_P(to));
347 to->utimezone = NULL;
348 to->should_delete = 0;
349 }
350 /* }}} */
351
352 /* {{{ TimeZone_objects_dtor */
TimeZone_objects_dtor(zend_object * object)353 static void TimeZone_objects_dtor(zend_object *object)
354 {
355 zend_objects_destroy_object(object);
356 }
357 /* }}} */
358
359 /* {{{ TimeZone_objects_free */
TimeZone_objects_free(zend_object * object)360 static void TimeZone_objects_free(zend_object *object)
361 {
362 TimeZone_object* to = php_intl_timezone_fetch_object(object);
363
364 if (to->utimezone && to->should_delete) {
365 delete to->utimezone;
366 to->utimezone = NULL;
367 }
368 intl_error_reset(TIMEZONE_ERROR_P(to));
369
370 zend_object_std_dtor(&to->zo);
371 }
372 /* }}} */
373
374 /* {{{ TimeZone_object_create */
TimeZone_object_create(zend_class_entry * ce)375 static zend_object *TimeZone_object_create(zend_class_entry *ce)
376 {
377 TimeZone_object* intern;
378
379 intern = (TimeZone_object*)ecalloc(1, sizeof(TimeZone_object) + sizeof(zval) * (ce->default_properties_count - 1));
380
381 zend_object_std_init(&intern->zo, ce);
382 object_properties_init(&intern->zo, ce);
383 TimeZone_object_init(intern);
384
385 intern->zo.handlers = &TimeZone_handlers;
386
387 return &intern->zo;
388 }
389 /* }}} */
390
391 /* {{{ TimeZone methods arguments info */
392
393 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_idarg, 0, 0, 1)
394 ZEND_ARG_INFO(0, zoneId)
395 ZEND_END_ARG_INFO()
396
397 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_fromDateTimeZone, 0, 0, 1)
398 ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
399 ZEND_END_ARG_INFO()
400
401 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createEnumeration, 0, 0, 0)
402 ZEND_ARG_INFO(0, countryOrRawOffset)
403 ZEND_END_ARG_INFO()
404
405 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_countEquivalentIDs, 0, 0, 1)
406 ZEND_ARG_INFO(0, zoneId)
407 ZEND_END_ARG_INFO()
408
409 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createTimeZoneIDEnumeration, 0, 0, 1)
410 ZEND_ARG_INFO(0, zoneType)
411 ZEND_ARG_INFO(0, region)
412 ZEND_ARG_INFO(0, rawOffset)
413 ZEND_END_ARG_INFO()
414
415 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getCanonicalID, 0, 0, 1)
416 ZEND_ARG_INFO(0, zoneId)
417 ZEND_ARG_INFO(1, isSystemID)
418 ZEND_END_ARG_INFO()
419
420 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getEquivalentID, 0, 0, 2)
421 ZEND_ARG_INFO(0, zoneId)
422 ZEND_ARG_INFO(0, index)
423 ZEND_END_ARG_INFO()
424
425 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getOffset, 0, 0, 4)
426 ZEND_ARG_INFO(0, date)
427 ZEND_ARG_INFO(0, local)
428 ZEND_ARG_INFO(1, rawOffset)
429 ZEND_ARG_INFO(1, dstOffset)
430 ZEND_END_ARG_INFO()
431
432 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_hasSameRules, 0, 0, 1)
433 ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
434 ZEND_END_ARG_INFO()
435
436 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getDisplayName, 0, 0, 0)
437 ZEND_ARG_INFO(0, isDaylight)
438 ZEND_ARG_INFO(0, style)
439 ZEND_ARG_INFO(0, locale)
440 ZEND_END_ARG_INFO()
441
442 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_void, 0, 0, 0)
443 ZEND_END_ARG_INFO()
444
445 #if U_ICU_VERSION_MAJOR_NUM >= 52
446 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getWindowsID, 0, ZEND_RETURN_VALUE, 1)
447 ZEND_ARG_INFO(0, timezone)
448 ZEND_END_ARG_INFO()
449
450 ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getIDForWindowsID, 0, ZEND_RETURN_VALUE, 1)
451 ZEND_ARG_INFO(0, timezone)
452 ZEND_ARG_INFO(0, region)
453 ZEND_END_ARG_INFO()
454 #endif
455
456 /* }}} */
457
458 /* {{{ TimeZone_class_functions
459 * Every 'IntlTimeZone' class method has an entry in this table
460 */
461 static const zend_function_entry TimeZone_class_functions[] = {
462 PHP_ME(IntlTimeZone, __construct, ainfo_tz_void, ZEND_ACC_PRIVATE)
463 PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
464 PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
465 PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
466 PHP_ME_MAPPING(getGMT, intltz_get_gmt, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
467 PHP_ME_MAPPING(getUnknown, intltz_get_unknown, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
468 PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, ainfo_tz_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
469 PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
470 PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
471 PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, ainfo_tz_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
472 PHP_ME_MAPPING(getRegion, intltz_get_region, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
473 PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
474 PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, ainfo_tz_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
475
476 PHP_ME_MAPPING(getID, intltz_get_id, ainfo_tz_void, ZEND_ACC_PUBLIC)
477 PHP_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, ainfo_tz_void, ZEND_ACC_PUBLIC)
478 PHP_ME_MAPPING(getOffset, intltz_get_offset, ainfo_tz_getOffset, ZEND_ACC_PUBLIC)
479 PHP_ME_MAPPING(getRawOffset, intltz_get_raw_offset, ainfo_tz_void, ZEND_ACC_PUBLIC)
480 PHP_ME_MAPPING(hasSameRules, intltz_has_same_rules, ainfo_tz_hasSameRules, ZEND_ACC_PUBLIC)
481 PHP_ME_MAPPING(getDisplayName, intltz_get_display_name, ainfo_tz_getDisplayName, ZEND_ACC_PUBLIC)
482 PHP_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, ainfo_tz_void, ZEND_ACC_PUBLIC)
483 PHP_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, ainfo_tz_void, ZEND_ACC_PUBLIC)
484 PHP_ME_MAPPING(getErrorCode, intltz_get_error_code, ainfo_tz_void, ZEND_ACC_PUBLIC)
485 PHP_ME_MAPPING(getErrorMessage, intltz_get_error_message, ainfo_tz_void, ZEND_ACC_PUBLIC)
486 #if U_ICU_VERSION_MAJOR_NUM >= 52
487 PHP_ME_MAPPING(getWindowsID, intltz_get_windows_id, ainfo_tz_getWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
488 PHP_ME_MAPPING(getIDForWindowsID, intltz_get_id_for_windows_id, ainfo_tz_getIDForWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
489 #endif
490 PHP_FE_END
491 };
492 /* }}} */
493
494 /* {{{ timezone_register_IntlTimeZone_class
495 * Initialize 'IntlTimeZone' class
496 */
timezone_register_IntlTimeZone_class(void)497 U_CFUNC void timezone_register_IntlTimeZone_class(void)
498 {
499 zend_class_entry ce;
500
501 /* Create and register 'IntlTimeZone' class. */
502 INIT_CLASS_ENTRY(ce, "IntlTimeZone", TimeZone_class_functions);
503 ce.create_object = TimeZone_object_create;
504 TimeZone_ce_ptr = zend_register_internal_class(&ce);
505 if (!TimeZone_ce_ptr) {
506 //can't happen now without bigger problems before
507 php_error_docref(NULL, E_ERROR,
508 "IntlTimeZone: class registration has failed.");
509 return;
510 }
511
512 memcpy(&TimeZone_handlers, &std_object_handlers,
513 sizeof TimeZone_handlers);
514 TimeZone_handlers.offset = XtOffsetOf(TimeZone_object, zo);
515 TimeZone_handlers.clone_obj = TimeZone_clone_obj;
516 TimeZone_handlers.compare_objects = TimeZone_compare_objects;
517 TimeZone_handlers.get_debug_info = TimeZone_get_debug_info;
518 TimeZone_handlers.dtor_obj = TimeZone_objects_dtor;
519 TimeZone_handlers.free_obj = TimeZone_objects_free;
520
521
522 /* Declare 'IntlTimeZone' class constants */
523 #define TIMEZONE_DECL_LONG_CONST(name, val) \
524 zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \
525 val)
526
527 TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT);
528 TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG);
529
530 TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
531 TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
532 TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
533 TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
534 TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
535 TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
536
537 TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
538 TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
539 TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
540
541 /* Declare 'IntlTimeZone' class properties */
542
543 }
544 /* }}} */
545