diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-05 20:57:57 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-09 13:37:24 +0100 |
commit | c6723728dff93c6d4276d32cac7bf2b8465be93a (patch) | |
tree | 5885b48a16e37b21a00814ce91e763b8e81dc7c5 /ext/intl | |
parent | 99b08ac2817672c108149a65509c79baf261e819 (diff) | |
download | php-git-c6723728dff93c6d4276d32cac7bf2b8465be93a.tar.gz |
Generate ext/intl class entries from stubs
Closes GH-6670
Diffstat (limited to 'ext/intl')
44 files changed, 276 insertions, 157 deletions
diff --git a/ext/intl/breakiterator/breakiterator.stub.php b/ext/intl/breakiterator/breakiterator.stub.php index 35a57e44b9..bae4726be4 100644 --- a/ext/intl/breakiterator/breakiterator.stub.php +++ b/ext/intl/breakiterator/breakiterator.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class IntlBreakIterator implements IteratorAggregate { @@ -86,12 +86,6 @@ class IntlRuleBasedBreakIterator extends IntlBreakIterator public function getRuleStatusVec() {} } -class IntlPartsIterator extends IntlIterator -{ - /** @return IntlBreakIterator */ - public function getBreakIterator() {} -} - class IntlCodePointBreakIterator extends IntlBreakIterator { /** @return int */ diff --git a/ext/intl/breakiterator/breakiterator_arginfo.h b/ext/intl/breakiterator/breakiterator_arginfo.h index ec8c0c3ce7..9e146ec244 100644 --- a/ext/intl/breakiterator/breakiterator_arginfo.h +++ b/ext/intl/breakiterator/breakiterator_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6a121ed9817667820f05677a772781d6b788796b */ + * Stub hash: 9e9dc1cd1302038f351f6075393494d1a58f0d74 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlBreakIterator_createCharacterInstance, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null") @@ -72,8 +72,6 @@ ZEND_END_ARG_INFO() #define arginfo_class_IntlRuleBasedBreakIterator_getRuleStatusVec arginfo_class_IntlBreakIterator_createCodePointInstance -#define arginfo_class_IntlPartsIterator_getBreakIterator arginfo_class_IntlBreakIterator_createCodePointInstance - #define arginfo_class_IntlCodePointBreakIterator_getLastCodePoint arginfo_class_IntlBreakIterator_createCodePointInstance @@ -104,7 +102,6 @@ ZEND_METHOD(IntlRuleBasedBreakIterator, getBinaryRules); ZEND_METHOD(IntlRuleBasedBreakIterator, getRules); ZEND_METHOD(IntlRuleBasedBreakIterator, getRuleStatus); ZEND_METHOD(IntlRuleBasedBreakIterator, getRuleStatusVec); -ZEND_METHOD(IntlPartsIterator, getBreakIterator); ZEND_METHOD(IntlCodePointBreakIterator, getLastCodePoint); @@ -145,13 +142,39 @@ static const zend_function_entry class_IntlRuleBasedBreakIterator_methods[] = { }; -static const zend_function_entry class_IntlPartsIterator_methods[] = { - ZEND_ME(IntlPartsIterator, getBreakIterator, arginfo_class_IntlPartsIterator_getBreakIterator, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - static const zend_function_entry class_IntlCodePointBreakIterator_methods[] = { ZEND_ME(IntlCodePointBreakIterator, getLastCodePoint, arginfo_class_IntlCodePointBreakIterator_getLastCodePoint, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_IntlBreakIterator(zend_class_entry *class_entry_IteratorAggregate) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlBreakIterator", class_IntlBreakIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_IteratorAggregate); + + return class_entry; +} + +zend_class_entry *register_class_IntlRuleBasedBreakIterator(zend_class_entry *class_entry_IntlBreakIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", class_IntlRuleBasedBreakIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlBreakIterator); + + return class_entry; +} + +zend_class_entry *register_class_IntlCodePointBreakIterator(zend_class_entry *class_entry_IntlBreakIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator", class_IntlCodePointBreakIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlBreakIterator); + + return class_entry; +} + diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 3f236db2d4..aa9dd03493 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -220,13 +220,11 @@ static zend_object *BreakIterator_object_create(zend_class_entry *ce) */ U_CFUNC void breakiterator_register_BreakIterator_class(void) { - zend_class_entry ce; - /* Create and register 'BreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "IntlBreakIterator", class_IntlBreakIterator_methods); - ce.create_object = BreakIterator_object_create; - ce.get_iterator = _breakiterator_get_iterator; - BreakIterator_ce_ptr = zend_register_internal_class(&ce); + + BreakIterator_ce_ptr = register_class_IntlBreakIterator(zend_ce_aggregate); + BreakIterator_ce_ptr->create_object = BreakIterator_object_create; + BreakIterator_ce_ptr->get_iterator = _breakiterator_get_iterator; memcpy(&BreakIterator_handlers, &std_object_handlers, sizeof BreakIterator_handlers); @@ -236,8 +234,6 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void) BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info; BreakIterator_handlers.free_obj = BreakIterator_objects_free; - zend_class_implements(BreakIterator_ce_ptr, 1, zend_ce_aggregate); - zend_declare_class_constant_long(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE ); @@ -271,15 +267,9 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void) /* Create and register 'RuleBasedBreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", - class_IntlRuleBasedBreakIterator_methods); - RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, - BreakIterator_ce_ptr); + RuleBasedBreakIterator_ce_ptr = register_class_IntlRuleBasedBreakIterator(BreakIterator_ce_ptr); /* Create and register 'CodePointBreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator", - class_IntlCodePointBreakIterator_methods); - CodePointBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, - BreakIterator_ce_ptr); + CodePointBreakIterator_ce_ptr = register_class_IntlCodePointBreakIterator(BreakIterator_ce_ptr); } /* }}} */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 7c955a5ecb..4eb0fd8da9 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -24,7 +24,7 @@ extern "C" { #define USE_BREAKITERATOR_POINTER #include "breakiterator_class.h" -#include "breakiterator_arginfo.h" +#include "breakiterator_iterators_arginfo.h" #include "../intl_convert.h" #include "../locale/locale.h" #include <zend_exceptions.h> @@ -287,12 +287,8 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator) U_CFUNC void breakiterator_register_IntlPartsIterator_class(void) { - zend_class_entry ce; - /* Create and register 'BreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "IntlPartsIterator", class_IntlPartsIterator_methods); - IntlPartsIterator_ce_ptr = zend_register_internal_class_ex(&ce, - IntlIterator_ce_ptr); + IntlPartsIterator_ce_ptr = register_class_IntlPartsIterator(IntlIterator_ce_ptr); IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create; memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers, diff --git a/ext/intl/breakiterator/breakiterator_iterators.stub.php b/ext/intl/breakiterator/breakiterator_iterators.stub.php new file mode 100644 index 0000000000..9a82640c20 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators.stub.php @@ -0,0 +1,9 @@ +<?php + +/** @generate-class-entries */ + +class IntlPartsIterator extends IntlIterator +{ + /** @return IntlBreakIterator */ + public function getBreakIterator() {} +} diff --git a/ext/intl/breakiterator/breakiterator_iterators_arginfo.h b/ext/intl/breakiterator/breakiterator_iterators_arginfo.h new file mode 100644 index 0000000000..1d95e3243a --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators_arginfo.h @@ -0,0 +1,25 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 5e165fe25d6d13824da9d7c5f0a089ee11626689 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlPartsIterator_getBreakIterator, 0, 0, 0) +ZEND_END_ARG_INFO() + + +ZEND_METHOD(IntlPartsIterator, getBreakIterator); + + +static const zend_function_entry class_IntlPartsIterator_methods[] = { + ZEND_ME(IntlPartsIterator, getBreakIterator, arginfo_class_IntlPartsIterator_getBreakIterator, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +zend_class_entry *register_class_IntlPartsIterator(zend_class_entry *class_entry_IntlIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlPartsIterator", class_IntlPartsIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlIterator); + + return class_entry; +} + diff --git a/ext/intl/calendar/calendar.stub.php b/ext/intl/calendar/calendar.stub.php index 3da6ebb1d0..68a2050c3a 100644 --- a/ext/intl/calendar/calendar.stub.php +++ b/ext/intl/calendar/calendar.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class IntlCalendar { diff --git a/ext/intl/calendar/calendar_arginfo.h b/ext/intl/calendar/calendar_arginfo.h index 8537836d5b..78bd855bdc 100644 --- a/ext/intl/calendar/calendar_arginfo.h +++ b/ext/intl/calendar/calendar_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 18a92d3af801f11e5c3b90e5d272fd98b3515c40 */ + * Stub hash: a0800bd27fe214cce7420e689e9d7b519a7b6835 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -270,3 +270,24 @@ static const zend_function_entry class_IntlGregorianCalendar_methods[] = { ZEND_ME_MAPPING(isLeapYear, intlgregcal_is_leap_year, arginfo_class_IntlGregorianCalendar_isLeapYear, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_IntlCalendar() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlCalendar", class_IntlCalendar_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +zend_class_entry *register_class_IntlGregorianCalendar(zend_class_entry *class_entry_IntlCalendar) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", class_IntlGregorianCalendar_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlCalendar); + + return class_entry; +} + diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index a46ef62e68..8c1bdf3185 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -268,12 +268,9 @@ static zend_object *Calendar_object_create(zend_class_entry *ce) */ void calendar_register_IntlCalendar_class(void) { - zend_class_entry ce; - /* Create and register 'IntlCalendar' class. */ - INIT_CLASS_ENTRY(ce, "IntlCalendar", class_IntlCalendar_methods); - ce.create_object = Calendar_object_create; - Calendar_ce_ptr = zend_register_internal_class(&ce); + Calendar_ce_ptr = register_class_IntlCalendar(); + Calendar_ce_ptr->create_object = Calendar_object_create; memcpy( &Calendar_handlers, &std_object_handlers, sizeof Calendar_handlers); @@ -331,8 +328,6 @@ void calendar_register_IntlCalendar_class(void) CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); /* Create and register 'IntlGregorianCalendar' class. */ - INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", class_IntlGregorianCalendar_methods); - GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce, - Calendar_ce_ptr); + GregorianCalendar_ce_ptr = register_class_IntlGregorianCalendar(Calendar_ce_ptr); } /* }}} */ diff --git a/ext/intl/collator/collator.stub.php b/ext/intl/collator/collator.stub.php index f42d1508cb..7a987a25ab 100644 --- a/ext/intl/collator/collator.stub.php +++ b/ext/intl/collator/collator.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class Collator { diff --git a/ext/intl/collator/collator_arginfo.h b/ext/intl/collator/collator_arginfo.h index 1b7dcc408f..c9685a84f2 100644 --- a/ext/intl/collator/collator_arginfo.h +++ b/ext/intl/collator/collator_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 869c6e60a8f2b153ef79f28a08e165ff3ec2bc14 */ + * Stub hash: 9907156bf1d28af7bf6a1858dffc58994c12756f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) @@ -85,3 +85,14 @@ static const zend_function_entry class_Collator_methods[] = { ZEND_ME_MAPPING(getSortKey, collator_get_sort_key, arginfo_class_Collator_getSortKey, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_Collator() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Collator", class_Collator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c index 44452c147f..7be73e8ea2 100644 --- a/ext/intl/collator/collator_class.c +++ b/ext/intl/collator/collator_class.c @@ -63,12 +63,9 @@ zend_object *Collator_object_create(zend_class_entry *ce ) */ void collator_register_Collator_class( void ) { - zend_class_entry ce; - /* Create and register 'Collator' class. */ - INIT_CLASS_ENTRY( ce, "Collator", class_Collator_methods ); - ce.create_object = Collator_object_create; - Collator_ce_ptr = zend_register_internal_class( &ce ); + Collator_ce_ptr = register_class_Collator(); + Collator_ce_ptr->create_object = Collator_object_create; memcpy(&Collator_handlers, &std_object_handlers, sizeof Collator_handlers); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 90971302ce..7c4ac65262 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -966,10 +966,7 @@ static zend_object *php_converter_clone_object(zend_object *object) { /* {{{ php_converter_minit */ int php_converter_minit(INIT_FUNC_ARGS) { - zend_class_entry ce; - - INIT_CLASS_ENTRY(ce, "UConverter", class_UConverter_methods); - php_converter_ce = zend_register_internal_class(&ce); + php_converter_ce = register_class_UConverter(); php_converter_ce->create_object = php_converter_create_object; memcpy(&php_converter_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); php_converter_object_handlers.offset = XtOffsetOf(php_converter_object, obj); diff --git a/ext/intl/converter/converter.stub.php b/ext/intl/converter/converter.stub.php index 5b82b098f4..8847bdcab0 100644 --- a/ext/intl/converter/converter.stub.php +++ b/ext/intl/converter/converter.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class UConverter { diff --git a/ext/intl/converter/converter_arginfo.h b/ext/intl/converter/converter_arginfo.h index 8b8f8fc1f5..60f6cab3d8 100644 --- a/ext/intl/converter/converter_arginfo.h +++ b/ext/intl/converter/converter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e33e2614c969c59b79c6062f7a347a8e8e486d85 */ + * Stub hash: c01b6c9d6a6754a2fffde1279bec3a984e6a2f34 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null") @@ -113,3 +113,14 @@ static const zend_function_entry class_UConverter_methods[] = { ZEND_ME(UConverter, transcode, arginfo_class_UConverter_transcode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_FE_END }; + +zend_class_entry *register_class_UConverter() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "UConverter", class_UConverter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php index 22ece903c1..7ffaa1fe5e 100644 --- a/ext/intl/dateformat/dateformat.stub.php +++ b/ext/intl/dateformat/dateformat.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class IntlDateFormatter { diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h index ff9fbfa6fd..65db5ecb95 100644 --- a/ext/intl/dateformat/dateformat_arginfo.h +++ b/ext/intl/dateformat/dateformat_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 62742b5f463272f43970e98900a89d513c4fb839 */ + * Stub hash: 4f93c3fca18c225b26dec1e970b783baa4622425 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) @@ -125,3 +125,14 @@ static const zend_function_entry class_IntlDateFormatter_methods[] = { ZEND_ME_MAPPING(getErrorMessage, datefmt_get_error_message, arginfo_class_IntlDateFormatter_getErrorMessage, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_IntlDateFormatter() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlDateFormatter", class_IntlDateFormatter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index 7d9dde20b0..b6e0283677 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -107,12 +107,9 @@ zend_object *IntlDateFormatter_object_clone(zend_object *object) */ void dateformat_register_IntlDateFormatter_class( void ) { - zend_class_entry ce; - /* Create and register 'IntlDateFormatter' class. */ - INIT_CLASS_ENTRY( ce, "IntlDateFormatter", class_IntlDateFormatter_methods ); - ce.create_object = IntlDateFormatter_object_create; - IntlDateFormatter_ce_ptr = zend_register_internal_class( &ce ); + IntlDateFormatter_ce_ptr = register_class_IntlDateFormatter(); + IntlDateFormatter_ce_ptr->create_object = IntlDateFormatter_object_create; memcpy(&IntlDateFormatter_handlers, &std_object_handlers, sizeof IntlDateFormatter_handlers); diff --git a/ext/intl/formatter/formatter.stub.php b/ext/intl/formatter/formatter.stub.php index 045b0640ce..8118b19d47 100644 --- a/ext/intl/formatter/formatter.stub.php +++ b/ext/intl/formatter/formatter.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class NumberFormatter { diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h index 79f977fb81..c30f2ad215 100644 --- a/ext/intl/formatter/formatter_arginfo.h +++ b/ext/intl/formatter/formatter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0f285bbaa6f4f37060eb8325956f41bd86e9dea3 */ + * Stub hash: 2a232c97981e23bec14f03e564a7ec3d7fedc31e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) @@ -111,3 +111,14 @@ static const zend_function_entry class_NumberFormatter_methods[] = { ZEND_ME_MAPPING(getErrorMessage, numfmt_get_error_message, arginfo_class_NumberFormatter_getErrorMessage, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_NumberFormatter() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "NumberFormatter", class_NumberFormatter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index f7965ec7d1..e2ff9989b6 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -94,12 +94,9 @@ zend_object *NumberFormatter_object_clone(zend_object *object) */ void formatter_register_class( void ) { - zend_class_entry ce; - /* Create and register 'NumberFormatter' class. */ - INIT_CLASS_ENTRY( ce, "NumberFormatter", class_NumberFormatter_methods ); - ce.create_object = NumberFormatter_object_create; - NumberFormatter_ce_ptr = zend_register_internal_class( &ce ); + NumberFormatter_ce_ptr = register_class_NumberFormatter(); + NumberFormatter_ce_ptr->create_object = NumberFormatter_object_create; NumberFormatter_ce_ptr->serialize = zend_class_serialize_deny; NumberFormatter_ce_ptr->unserialize = zend_class_unserialize_deny; diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index 6babe70152..64cf45ce61 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -203,17 +203,6 @@ void intl_errors_set_code( intl_error* err, UErrorCode err_code ) } /* }}} */ -void intl_register_IntlException_class( void ) -{ - zend_class_entry ce; - - /* Create and register 'IntlException' class. */ - INIT_CLASS_ENTRY_EX( ce, "IntlException", sizeof( "IntlException" ) - 1, NULL ); - IntlException_ce_ptr = zend_register_internal_class_ex( &ce, - zend_ce_exception ); - IntlException_ce_ptr->create_object = zend_ce_exception->create_object; -} - smart_str intl_parse_error_to_string( UParseError* pe ) { smart_str ret = {0}; diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h index 927e5cdfd2..bcf5d2cc4a 100644 --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -47,7 +47,4 @@ void intl_errors_set( intl_error* err, UErrorCode code, const char* msg, // Other error helpers smart_str intl_parse_error_to_string( UParseError* pe ); -// exported to be called on extension MINIT -void intl_register_IntlException_class( void ); - #endif // INTL_ERROR_H diff --git a/ext/intl/locale/locale.stub.php b/ext/intl/locale/locale.stub.php index e5703293c0..f20d2d3d97 100644 --- a/ext/intl/locale/locale.stub.php +++ b/ext/intl/locale/locale.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class Locale { diff --git a/ext/intl/locale/locale_arginfo.h b/ext/intl/locale/locale_arginfo.h index e952146362..46c828f519 100644 --- a/ext/intl/locale/locale_arginfo.h +++ b/ext/intl/locale/locale_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4135dc9df49d3fe20275d49bad428a2e3e0a8752 */ + * Stub hash: 6b873a68045fb5cf75e23991a3c77aa01a8893ee */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_getDefault, 0, 0, 0) ZEND_END_ARG_INFO() @@ -98,3 +98,14 @@ static const zend_function_entry class_Locale_methods[] = { ZEND_ME_MAPPING(acceptFromHttp, locale_accept_from_http, arginfo_class_Locale_acceptFromHttp, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_FE_END }; + +zend_class_entry *register_class_Locale() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Locale", class_Locale_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c index 0670f55620..852988b4a6 100644 --- a/ext/intl/locale/locale_class.c +++ b/ext/intl/locale/locale_class.c @@ -30,19 +30,8 @@ zend_class_entry *Locale_ce_ptr = NULL; */ void locale_register_Locale_class( void ) { - zend_class_entry ce; - /* Create and register 'Locale' class. */ - INIT_CLASS_ENTRY( ce, "Locale", class_Locale_methods ); - ce.create_object = NULL; - Locale_ce_ptr = zend_register_internal_class( &ce ); - - /* Declare 'Locale' class properties. */ - if( !Locale_ce_ptr ) - { - zend_error( E_ERROR, - "Locale: Failed to register Locale class."); - return; - } + Locale_ce_ptr = register_class_Locale(); + Locale_ce_ptr->create_object = NULL; } /* }}} */ diff --git a/ext/intl/msgformat/msgformat.stub.php b/ext/intl/msgformat/msgformat.stub.php index a9a3e3e181..f46e663203 100644 --- a/ext/intl/msgformat/msgformat.stub.php +++ b/ext/intl/msgformat/msgformat.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class MessageFormatter { diff --git a/ext/intl/msgformat/msgformat_arginfo.h b/ext/intl/msgformat/msgformat_arginfo.h index 3bad9aa498..958f7dd8ea 100644 --- a/ext/intl/msgformat/msgformat_arginfo.h +++ b/ext/intl/msgformat/msgformat_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ece8c5157dc3a62ca2951d058b3c5497bb5cb836 */ + * Stub hash: 0d5b34913965434a4015e2b6ac7288edbbafc3f3 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) @@ -69,3 +69,14 @@ static const zend_function_entry class_MessageFormatter_methods[] = { ZEND_ME_MAPPING(getErrorMessage, msgfmt_get_error_message, arginfo_class_MessageFormatter_getErrorMessage, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_MessageFormatter() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "MessageFormatter", class_MessageFormatter_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index d8bf9a006c..d8274a1440 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -93,12 +93,9 @@ zend_object *MessageFormatter_object_clone(zend_object *object) */ void msgformat_register_class( void ) { - zend_class_entry ce; - /* Create and register 'MessageFormatter' class. */ - INIT_CLASS_ENTRY( ce, "MessageFormatter", class_MessageFormatter_methods ); - ce.create_object = MessageFormatter_object_create; - MessageFormatter_ce_ptr = zend_register_internal_class( &ce ); + MessageFormatter_ce_ptr = register_class_MessageFormatter(); + MessageFormatter_ce_ptr->create_object = MessageFormatter_object_create; memcpy(&MessageFormatter_handlers, &std_object_handlers, sizeof MessageFormatter_handlers); diff --git a/ext/intl/normalizer/normalizer.stub.php b/ext/intl/normalizer/normalizer.stub.php index 243ace532d..0c9e1785dc 100644 --- a/ext/intl/normalizer/normalizer.stub.php +++ b/ext/intl/normalizer/normalizer.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class Normalizer { diff --git a/ext/intl/normalizer/normalizer_arginfo.h b/ext/intl/normalizer/normalizer_arginfo.h index cd5a41de60..efd94ead6b 100644 --- a/ext/intl/normalizer/normalizer_arginfo.h +++ b/ext/intl/normalizer/normalizer_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3b9ef4888cc32bd009fb87db52859953902454fc */ + * Stub hash: 651065249a99f9ee50126d58223b8f4527e3fc09 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_normalize, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) @@ -31,3 +31,14 @@ static const zend_function_entry class_Normalizer_methods[] = { #endif ZEND_FE_END }; + +zend_class_entry *register_class_Normalizer() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Normalizer", class_Normalizer_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c index 7a46acb0b2..29299da206 100644 --- a/ext/intl/normalizer/normalizer_class.c +++ b/ext/intl/normalizer/normalizer_class.c @@ -30,20 +30,8 @@ zend_class_entry *Normalizer_ce_ptr = NULL; */ void normalizer_register_Normalizer_class( void ) { - zend_class_entry ce; - /* Create and register 'Normalizer' class. */ - INIT_CLASS_ENTRY( ce, "Normalizer", class_Normalizer_methods ); - ce.create_object = NULL; - Normalizer_ce_ptr = zend_register_internal_class( &ce ); - - /* Declare 'Normalizer' class properties. */ - if( !Normalizer_ce_ptr ) - { - zend_error( E_ERROR, - "Normalizer: attempt to create properties " - "on a non-registered class." ); - return; - } + Normalizer_ce_ptr = register_class_Normalizer(); + Normalizer_ce_ptr->create_object = NULL; } /* }}} */ diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 2b91266e7e..01361ed262 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -215,7 +215,8 @@ PHP_MINIT_FUNCTION( intl ) spoofchecker_register_constants( INIT_FUNC_ARGS_PASSTHRU ); /* Register 'IntlException' PHP class */ - intl_register_IntlException_class( ); + IntlException_ce_ptr = register_class_IntlException(zend_ce_exception); + IntlException_ce_ptr->create_object = zend_ce_exception->create_object; /* Register 'IntlIterator' PHP class */ intl_register_IntlIterator_class( ); @@ -224,7 +225,7 @@ PHP_MINIT_FUNCTION( intl ) breakiterator_register_BreakIterator_class( ); /* Register 'IntlPartsIterator' class */ - breakiterator_register_IntlPartsIterator_class( ); + breakiterator_register_IntlPartsIterator_class(); /* Global error handling. */ intl_error_init( NULL ); diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index 26b7922c2c..70bb606da4 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -1,6 +1,10 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ + +class IntlException extends Exception +{ +} /* calendar */ diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 57299b841f..6d52b53b57 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c890e3cde79ffeade4623001cc369aa734812959 */ + * Stub hash: 9ddf3e4e42735c34a8b53a1856d6dc93346afc6f */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null") @@ -1165,3 +1165,19 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(transliterator_get_error_message, arginfo_transliterator_get_error_message) ZEND_FE_END }; + + +static const zend_function_entry class_IntlException_methods[] = { + ZEND_FE_END +}; + +zend_class_entry *register_class_IntlException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlException", class_IntlException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php index 4fdd49473c..a1e4948045 100644 --- a/ext/intl/spoofchecker/spoofchecker.stub.php +++ b/ext/intl/spoofchecker/spoofchecker.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class Spoofchecker { diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h index 6079794fdf..a0e7c91d4d 100644 --- a/ext/intl/spoofchecker/spoofchecker_arginfo.h +++ b/ext/intl/spoofchecker/spoofchecker_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 10c330c8e06dbe21833f9c556b005fde2ea0ab42 */ + * Stub hash: b0317673c829b873b95aac34d362cd5ad004aca9 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -51,3 +51,14 @@ static const zend_function_entry class_Spoofchecker_methods[] = { #endif ZEND_FE_END }; + +zend_class_entry *register_class_Spoofchecker() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Spoofchecker", class_Spoofchecker_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index e1c8dc63a1..bbb341cda4 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -90,12 +90,9 @@ static zend_object *spoofchecker_clone_obj(zend_object *object) /* {{{ */ */ void spoofchecker_register_Spoofchecker_class(void) { - zend_class_entry ce; - /* Create and register 'Spoofchecker' class. */ - INIT_CLASS_ENTRY(ce, "Spoofchecker", class_Spoofchecker_methods); - ce.create_object = Spoofchecker_object_create; - Spoofchecker_ce_ptr = zend_register_internal_class(&ce); + Spoofchecker_ce_ptr = register_class_Spoofchecker(); + Spoofchecker_ce_ptr->create_object = Spoofchecker_object_create; memcpy(&Spoofchecker_handlers, &std_object_handlers, sizeof Spoofchecker_handlers); diff --git a/ext/intl/timezone/timezone.stub.php b/ext/intl/timezone/timezone.stub.php index 60ec7524a6..e8d46bde87 100644 --- a/ext/intl/timezone/timezone.stub.php +++ b/ext/intl/timezone/timezone.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class IntlTimeZone { diff --git a/ext/intl/timezone/timezone_arginfo.h b/ext/intl/timezone/timezone_arginfo.h index f59fd9024b..d828675b47 100644 --- a/ext/intl/timezone/timezone_arginfo.h +++ b/ext/intl/timezone/timezone_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: afd0e74b29d54cde9789787b924af9b43539a7f4 */ + * Stub hash: 02045a0de09413796dd1ca7495b0b1beff14a074 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -152,3 +152,14 @@ static const zend_function_entry class_IntlTimeZone_methods[] = { ZEND_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, arginfo_class_IntlTimeZone_useDaylightTime, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +zend_class_entry *register_class_IntlTimeZone() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlTimeZone", class_IntlTimeZone_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index f5749fd621..13e691ad97 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -396,18 +396,9 @@ static zend_object *TimeZone_object_create(zend_class_entry *ce) */ U_CFUNC void timezone_register_IntlTimeZone_class(void) { - zend_class_entry ce; - /* Create and register 'IntlTimeZone' class. */ - INIT_CLASS_ENTRY(ce, "IntlTimeZone", class_IntlTimeZone_methods); - ce.create_object = TimeZone_object_create; - TimeZone_ce_ptr = zend_register_internal_class(&ce); - if (!TimeZone_ce_ptr) { - //can't happen now without bigger problems before - php_error_docref(NULL, E_ERROR, - "IntlTimeZone: class registration has failed."); - return; - } + TimeZone_ce_ptr = register_class_IntlTimeZone(); + TimeZone_ce_ptr->create_object = TimeZone_object_create; memcpy(&TimeZone_handlers, &std_object_handlers, sizeof TimeZone_handlers); diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c index 0f44b454b4..ee90007546 100644 --- a/ext/intl/uchar/uchar.c +++ b/ext/intl/uchar/uchar.c @@ -612,10 +612,9 @@ IC_CHAR_METHOD_CHAR(getBidiPairedBracket) /* }}} */ int php_uchar_minit(INIT_FUNC_ARGS) { - zend_class_entry tmp, *ce; + zend_class_entry *ce; - INIT_CLASS_ENTRY(tmp, "IntlChar", class_IntlChar_methods); - ce = zend_register_internal_class(&tmp); + ce = register_class_IntlChar(); #define IC_CONSTL(name, val) \ zend_declare_class_constant_long(ce, name, strlen(name), val); diff --git a/ext/intl/uchar/uchar.stub.php b/ext/intl/uchar/uchar.stub.php index f3ebd78bcb..2bb667e44e 100644 --- a/ext/intl/uchar/uchar.stub.php +++ b/ext/intl/uchar/uchar.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class IntlChar { diff --git a/ext/intl/uchar/uchar_arginfo.h b/ext/intl/uchar/uchar_arginfo.h index c4e22cd767..0780fcee6c 100644 --- a/ext/intl/uchar/uchar_arginfo.h +++ b/ext/intl/uchar/uchar_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 05ea5d884642e75721f90728fb24b7ad5ce46897 */ + * Stub hash: 65836ce6bd16316bb022bc75ce5e2fbbdd1880b7 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlChar_hasBinaryProperty, 0, 0, 2) ZEND_ARG_TYPE_MASK(0, codepoint, MAY_BE_LONG|MAY_BE_STRING, NULL) @@ -295,3 +295,14 @@ static const zend_function_entry class_IntlChar_methods[] = { ZEND_ME(IntlChar, toupper, arginfo_class_IntlChar_toupper, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_FE_END }; + +zend_class_entry *register_class_IntlChar() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IntlChar", class_IntlChar_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + |