From 72beff0d414ef45c06f118f7f60d5cd194c6a013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 1 Jun 2012 17:17:35 +0200 Subject: [PATCH] Added private constructor to IntlTimeZone. --- ext/intl/timezone/timezone_class.cpp | 1 + ext/intl/timezone/timezone_methods.cpp | 7 +++++++ ext/intl/timezone/timezone_methods.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 850da4a7481..c976eb143ac 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -524,6 +524,7 @@ ZEND_END_ARG_INFO() * Every 'IntlTimeZone' class method has an entry in this table */ static zend_function_entry TimeZone_class_functions[] = { + PHP_ME(IntlTimeZone, __construct, ainfo_tz_void, ZEND_ACC_PRIVATE) PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index e596cc5174a..b7f31c3f3b4 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -34,6 +34,13 @@ extern "C" { } #include "common/common_enum.h" +U_CFUNC PHP_METHOD(IntlTimeZone, __construct) +{ + zend_throw_exception( NULL, + "An object of this type cannot be created with the new operator", + 0 TSRMLS_CC ); +} + U_CFUNC PHP_FUNCTION(intltz_create_time_zone) { char *str_id; diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h index 824f72a0d21..e153418ea72 100644 --- a/ext/intl/timezone/timezone_methods.h +++ b/ext/intl/timezone/timezone_methods.h @@ -19,6 +19,8 @@ #include +PHP_METHOD(IntlTimeZone, __construct) + PHP_FUNCTION(intltz_create_time_zone); PHP_FUNCTION(intltz_from_date_time_zone);