diff options
29 files changed, 843 insertions, 233 deletions
diff --git a/ext/spl/php_spl.stub.php b/ext/spl/php_spl.stub.php index 61b2165c9f..e7cc10dbc3 100644 --- a/ext/spl/php_spl.stub.php +++ b/ext/spl/php_spl.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ /** @param object|string $object_or_class */ function class_implements($object_or_class, bool $autoload = true): array|false {} diff --git a/ext/spl/php_spl_arginfo.h b/ext/spl/php_spl_arginfo.h index 5711e6d699..bd2a180764 100644 --- a/ext/spl/php_spl_arginfo.h +++ b/ext/spl/php_spl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 920cc4fca334f59316fc4276277958c9738afb3e */ + * Stub hash: 54d193c03c2652ce40adabd10d88666a86e32728 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_implements, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_INFO(0, object_or_class) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index e01259a30e..519e45a768 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1817,7 +1817,7 @@ PHP_METHOD(ArrayObject, __unserialize) RETURN_THROWS(); } - if (!instanceof_function(ce, spl_ce_Iterator)) { + if (!instanceof_function(ce, zend_ce_iterator)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Cannot deserialize ArrayObject with iterator class '%s'; this class does not implement the Iterator interface", ZSTR_VAL(Z_STR_P(iterator_class_zv))); @@ -1842,11 +1842,9 @@ PHP_METHOD(ArrayObject, __debugInfo) /* {{{ PHP_MINIT_FUNCTION(spl_array) */ PHP_MINIT_FUNCTION(spl_array) { - REGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, class_ArrayObject_methods); - REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); - REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); - REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable); - REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); + spl_ce_ArrayObject = register_class_ArrayObject(zend_ce_aggregate, zend_ce_arrayaccess, zend_ce_serializable, zend_ce_countable); + spl_ce_ArrayObject->create_object = spl_array_object_new; + memcpy(&spl_handler_ArrayObject, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_ArrayObject.offset = XtOffsetOf(spl_array_object, std); @@ -1870,16 +1868,12 @@ PHP_MINIT_FUNCTION(spl_array) spl_handler_ArrayObject.dtor_obj = zend_objects_destroy_object; spl_handler_ArrayObject.free_obj = spl_array_object_free_storage; - REGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, class_ArrayIterator_methods); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); - memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); + spl_ce_ArrayIterator = register_class_ArrayIterator(spl_ce_SeekableIterator, zend_ce_arrayaccess, zend_ce_serializable, zend_ce_countable); + spl_ce_ArrayIterator->create_object = spl_array_object_new; spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator; spl_ce_ArrayIterator->ce_flags |= ZEND_ACC_REUSE_GET_ITERATOR; + memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); @@ -1887,8 +1881,8 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, class_RecursiveArrayIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); + spl_ce_RecursiveArrayIterator = register_class_RecursiveArrayIterator(spl_ce_ArrayIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveArrayIterator->create_object = spl_array_object_new; spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; spl_ce_RecursiveArrayIterator->ce_flags |= ZEND_ACC_REUSE_GET_ITERATOR; diff --git a/ext/spl/spl_array.stub.php b/ext/spl/spl_array.stub.php index 1567d107f2..f6f1427011 100644 --- a/ext/spl/spl_array.stub.php +++ b/ext/spl/spl_array.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable { diff --git a/ext/spl/spl_array_arginfo.h b/ext/spl/spl_array_arginfo.h index 860b2e363d..8dce2260e2 100644 --- a/ext/spl/spl_array_arginfo.h +++ b/ext/spl/spl_array_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: da85db1e5e985ddbefaf38598133e3cba46475f2 */ + * Stub hash: 38cb41de1caa42ba96573cbbd33e5ae971065b8a */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0) ZEND_ARG_TYPE_MASK(0, array, MAY_BE_ARRAY|MAY_BE_OBJECT, "[]") @@ -244,3 +244,36 @@ static const zend_function_entry class_RecursiveArrayIterator_methods[] = { ZEND_ME(RecursiveArrayIterator, getChildren, arginfo_class_RecursiveArrayIterator_getChildren, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_ArrayObject(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ArrayObject", class_ArrayObject_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, class_entry_ArrayAccess, class_entry_Serializable, class_entry_Countable); + + return class_entry; +} + +static zend_class_entry *register_class_ArrayIterator(zend_class_entry *class_entry_SeekableIterator, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ArrayIterator", class_ArrayIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 4, class_entry_SeekableIterator, class_entry_ArrayAccess, class_entry_Serializable, class_entry_Countable); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveArrayIterator(zend_class_entry *class_entry_ArrayIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveArrayIterator", class_RecursiveArrayIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_ArrayIterator); + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 41e877534a..c26cd1aa89 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2730,7 +2730,9 @@ PHP_METHOD(SplFileObject, seek) /* {{{ PHP_MINIT_FUNCTION(spl_directory) */ PHP_MINIT_FUNCTION(spl_directory) { - REGISTER_SPL_STD_CLASS_EX(SplFileInfo, spl_filesystem_object_new, class_SplFileInfo_methods); + spl_ce_SplFileInfo = register_class_SplFileInfo(zend_ce_stringable); + spl_ce_SplFileInfo->create_object = spl_filesystem_object_new; + memcpy(&spl_filesystem_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); spl_filesystem_object_handlers.offset = XtOffsetOf(spl_filesystem_object, std); spl_filesystem_object_handlers.clone_obj = spl_filesystem_object_clone; @@ -2739,16 +2741,14 @@ PHP_MINIT_FUNCTION(spl_directory) spl_filesystem_object_handlers.free_obj = spl_filesystem_object_free_storage; spl_ce_SplFileInfo->serialize = zend_class_serialize_deny; spl_ce_SplFileInfo->unserialize = zend_class_unserialize_deny; - REGISTER_SPL_IMPLEMENTS(SplFileInfo, Stringable); - - - REGISTER_SPL_SUB_CLASS_EX(DirectoryIterator, SplFileInfo, spl_filesystem_object_new, class_DirectoryIterator_methods); - zend_class_implements(spl_ce_DirectoryIterator, 1, zend_ce_iterator); - REGISTER_SPL_IMPLEMENTS(DirectoryIterator, SeekableIterator); + spl_ce_DirectoryIterator = register_class_DirectoryIterator(spl_ce_SplFileInfo, spl_ce_SeekableIterator); + spl_ce_DirectoryIterator->create_object = spl_filesystem_object_new; spl_ce_DirectoryIterator->get_iterator = spl_filesystem_dir_get_iterator; - REGISTER_SPL_SUB_CLASS_EX(FilesystemIterator, DirectoryIterator, spl_filesystem_object_new, class_FilesystemIterator_methods); + spl_ce_FilesystemIterator = register_class_FilesystemIterator(spl_ce_DirectoryIterator); + spl_ce_FilesystemIterator->create_object = spl_filesystem_object_new; + spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator; REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); @@ -2763,30 +2763,29 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); - spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator; - - REGISTER_SPL_SUB_CLASS_EX(RecursiveDirectoryIterator, FilesystemIterator, spl_filesystem_object_new, class_RecursiveDirectoryIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveDirectoryIterator, RecursiveIterator); + spl_ce_RecursiveDirectoryIterator = register_class_RecursiveDirectoryIterator(spl_ce_FilesystemIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveDirectoryIterator->create_object = spl_filesystem_object_new; memcpy(&spl_filesystem_object_check_handlers, &spl_filesystem_object_handlers, sizeof(zend_object_handlers)); spl_filesystem_object_check_handlers.clone_obj = NULL; spl_filesystem_object_check_handlers.get_method = spl_filesystem_object_get_method_check; #ifdef HAVE_GLOB - REGISTER_SPL_SUB_CLASS_EX(GlobIterator, FilesystemIterator, spl_filesystem_object_new_check, class_GlobIterator_methods); - REGISTER_SPL_IMPLEMENTS(GlobIterator, Countable); + spl_ce_GlobIterator = register_class_GlobIterator(spl_ce_FilesystemIterator, zend_ce_countable); + spl_ce_GlobIterator->create_object = spl_filesystem_object_new_check; #endif - REGISTER_SPL_SUB_CLASS_EX(SplFileObject, SplFileInfo, spl_filesystem_object_new_check, class_SplFileObject_methods); - REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator); - REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator); + spl_ce_SplFileObject = register_class_SplFileObject(spl_ce_SplFileInfo, spl_ce_RecursiveIterator, spl_ce_SeekableIterator); + spl_ce_SplFileObject->create_object = spl_filesystem_object_new_check; REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); - REGISTER_SPL_SUB_CLASS_EX(SplTempFileObject, SplFileObject, spl_filesystem_object_new_check, class_SplTempFileObject_methods); + spl_ce_SplTempFileObject = register_class_SplTempFileObject(spl_ce_SplFileObject); + spl_ce_SplTempFileObject->create_object = spl_filesystem_object_new_check; + return SUCCESS; } /* }}} */ diff --git a/ext/spl/spl_directory.stub.php b/ext/spl/spl_directory.stub.php index 681547e55f..80b708a3f4 100644 --- a/ext/spl/spl_directory.stub.php +++ b/ext/spl/spl_directory.stub.php @@ -1,8 +1,8 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ -class SplFileInfo +class SplFileInfo implements Stringable { public function __construct(string $filename) {} diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index a16c4d45d0..252a82fb74 100644 --- a/ext/spl/spl_directory_arginfo.h +++ b/ext/spl/spl_directory_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 285af54cf7b3f3ef3f0d673b248c5afbd4cc440e */ + * Stub hash: de510a0512057bfaecbac8228107600ed14e2ba5 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -471,3 +471,78 @@ static const zend_function_entry class_SplTempFileObject_methods[] = { ZEND_ME(SplTempFileObject, __construct, arginfo_class_SplTempFileObject___construct, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_SplFileInfo(zend_class_entry *class_entry_Stringable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplFileInfo", class_SplFileInfo_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Stringable); + + return class_entry; +} + +static zend_class_entry *register_class_DirectoryIterator(zend_class_entry *class_entry_SplFileInfo, zend_class_entry *class_entry_SeekableIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "DirectoryIterator", class_DirectoryIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplFileInfo); + zend_class_implements(class_entry, 1, class_entry_SeekableIterator); + + return class_entry; +} + +static zend_class_entry *register_class_FilesystemIterator(zend_class_entry *class_entry_DirectoryIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "FilesystemIterator", class_FilesystemIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_DirectoryIterator); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveDirectoryIterator(zend_class_entry *class_entry_FilesystemIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveDirectoryIterator", class_RecursiveDirectoryIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FilesystemIterator); + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} + +static zend_class_entry *register_class_GlobIterator(zend_class_entry *class_entry_FilesystemIterator, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "GlobIterator", class_GlobIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FilesystemIterator); + zend_class_implements(class_entry, 1, class_entry_Countable); + + return class_entry; +} + +static zend_class_entry *register_class_SplFileObject(zend_class_entry *class_entry_SplFileInfo, zend_class_entry *class_entry_RecursiveIterator, zend_class_entry *class_entry_SeekableIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplFileObject", class_SplFileObject_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplFileInfo); + zend_class_implements(class_entry, 2, class_entry_RecursiveIterator, class_entry_SeekableIterator); + + return class_entry; +} + +static zend_class_entry *register_class_SplTempFileObject(zend_class_entry *class_entry_SplFileObject) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplTempFileObject", class_SplTempFileObject_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplFileObject); + + return class_entry; +} diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index bc311589b6..5e42c44d42 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1332,7 +1332,12 @@ zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ { - REGISTER_SPL_STD_CLASS_EX(SplDoublyLinkedList, spl_dllist_object_new, class_SplDoublyLinkedList_methods); + spl_ce_SplDoublyLinkedList = register_class_SplDoublyLinkedList( + zend_ce_iterator, zend_ce_countable, zend_ce_arrayaccess, zend_ce_serializable + ); + spl_ce_SplDoublyLinkedList->create_object = spl_dllist_object_new; + spl_ce_SplDoublyLinkedList->get_iterator = spl_dllist_get_iterator; + memcpy(&spl_handler_SplDoublyLinkedList, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_SplDoublyLinkedList.offset = XtOffsetOf(spl_dllist_object, std); @@ -1347,17 +1352,12 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_KEEP", 0); - REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Iterator); - REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Countable); - REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, ArrayAccess); - REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Serializable); - - spl_ce_SplDoublyLinkedList->get_iterator = spl_dllist_get_iterator; - - REGISTER_SPL_SUB_CLASS_EX(SplQueue, SplDoublyLinkedList, spl_dllist_object_new, class_SplQueue_methods); - REGISTER_SPL_SUB_CLASS_EX(SplStack, SplDoublyLinkedList, spl_dllist_object_new, class_SplStack_methods); - + spl_ce_SplQueue = register_class_SplQueue(spl_ce_SplDoublyLinkedList); + spl_ce_SplQueue->create_object = spl_dllist_object_new; spl_ce_SplQueue->get_iterator = spl_dllist_get_iterator; + + spl_ce_SplStack = register_class_SplStack(spl_ce_SplDoublyLinkedList); + spl_ce_SplStack->create_object = spl_dllist_object_new; spl_ce_SplStack->get_iterator = spl_dllist_get_iterator; return SUCCESS; diff --git a/ext/spl/spl_dllist.stub.php b/ext/spl/spl_dllist.stub.php index 05f122204e..36b945afb7 100644 --- a/ext/spl/spl_dllist.stub.php +++ b/ext/spl/spl_dllist.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable { diff --git a/ext/spl/spl_dllist_arginfo.h b/ext/spl/spl_dllist_arginfo.h index eb612acb83..5162ff2957 100644 --- a/ext/spl/spl_dllist_arginfo.h +++ b/ext/spl/spl_dllist_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 404df73577d733275e386226e11887b37a500ade */ + * Stub hash: d0c98e1628895a81ac0b4abe62dede9ed2c7f55e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_add, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) @@ -144,3 +144,34 @@ static const zend_function_entry class_SplQueue_methods[] = { static const zend_function_entry class_SplStack_methods[] = { ZEND_FE_END }; + +static zend_class_entry *register_class_SplDoublyLinkedList(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_Countable, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplDoublyLinkedList", class_SplDoublyLinkedList_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 4, class_entry_Iterator, class_entry_Countable, class_entry_ArrayAccess, class_entry_Serializable); + + return class_entry; +} + +static zend_class_entry *register_class_SplQueue(zend_class_entry *class_entry_SplDoublyLinkedList) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplQueue", class_SplQueue_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplDoublyLinkedList); + + return class_entry; +} + +static zend_class_entry *register_class_SplStack(zend_class_entry *class_entry_SplDoublyLinkedList) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplStack", class_SplStack_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplDoublyLinkedList); + + return class_entry; +} diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c index e176776a1f..c4f39aeb16 100644 --- a/ext/spl/spl_exceptions.c +++ b/ext/spl/spl_exceptions.c @@ -23,6 +23,7 @@ #include "ext/standard/info.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "spl_exceptions_arginfo.h" #include "php_spl.h" #include "spl_functions.h" @@ -48,20 +49,20 @@ PHPAPI zend_class_entry *spl_ce_UnexpectedValueException; /* {{{ PHP_MINIT_FUNCTION(spl_exceptions) */ PHP_MINIT_FUNCTION(spl_exceptions) { - REGISTER_SPL_SUB_CLASS_EX(LogicException, Exception, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(BadFunctionCallException, LogicException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(BadMethodCallException, BadFunctionCallException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(DomainException, LogicException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(InvalidArgumentException, LogicException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(LengthException, LogicException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(OutOfRangeException, LogicException, NULL, NULL); + spl_ce_LogicException = register_class_LogicException(zend_ce_exception); + spl_ce_BadFunctionCallException = register_class_BadFunctionCallException(spl_ce_LogicException); + spl_ce_BadMethodCallException = register_class_BadMethodCallException(spl_ce_BadFunctionCallException); + spl_ce_DomainException = register_class_DomainException(spl_ce_LogicException); + spl_ce_InvalidArgumentException = register_class_InvalidArgumentException(spl_ce_LogicException); + spl_ce_LengthException = register_class_LengthException(spl_ce_LogicException); + spl_ce_OutOfRangeException = register_class_OutOfRangeException(spl_ce_LogicException); - REGISTER_SPL_SUB_CLASS_EX(RuntimeException, Exception, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(OutOfBoundsException, RuntimeException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(OverflowException, RuntimeException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(RangeException, RuntimeException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(UnderflowException, RuntimeException, NULL, NULL); - REGISTER_SPL_SUB_CLASS_EX(UnexpectedValueException, RuntimeException, NULL, NULL); + spl_ce_RuntimeException = register_class_RuntimeException(zend_ce_exception); + spl_ce_OutOfBoundsException = register_class_OutOfBoundsException(spl_ce_RuntimeException); + spl_ce_OverflowException = register_class_OverflowException(spl_ce_RuntimeException); + spl_ce_RangeException = register_class_RangeException(spl_ce_RuntimeException); + spl_ce_UnderflowException = register_class_UnderflowException(spl_ce_RuntimeException); + spl_ce_UnexpectedValueException = register_class_UnexpectedValueException(spl_ce_RuntimeException); return SUCCESS; } diff --git a/ext/spl/spl_exceptions.stub.php b/ext/spl/spl_exceptions.stub.php new file mode 100644 index 0000000000..09ca1b1326 --- /dev/null +++ b/ext/spl/spl_exceptions.stub.php @@ -0,0 +1,55 @@ +<?php + +/** @generate-class-entries */ + +class LogicException extends Exception +{ +} + +class BadFunctionCallException extends LogicException +{ +} + +class BadMethodCallException extends BadFunctionCallException +{ +} + +class DomainException extends LogicException +{ +} + +class InvalidArgumentException extends LogicException +{ +} + +class LengthException extends LogicException +{ +} + +class OutOfRangeException extends LogicException +{ +} + +class RuntimeException extends Exception +{ +} + +class OutOfBoundsException extends RuntimeException +{ +} + +class OverflowException extends RuntimeException +{ +} + +class RangeException extends RuntimeException +{ +} + +class UnderflowException extends RuntimeException +{ +} + +class UnexpectedValueException extends RuntimeException +{ +} diff --git a/ext/spl/spl_exceptions_arginfo.h b/ext/spl/spl_exceptions_arginfo.h new file mode 100644 index 0000000000..a35fdc8411 --- /dev/null +++ b/ext/spl/spl_exceptions_arginfo.h @@ -0,0 +1,199 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 07475caecc81ab3b38a04905f874615af1126289 */ + + + + +static const zend_function_entry class_LogicException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_BadFunctionCallException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_BadMethodCallException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_DomainException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_InvalidArgumentException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_LengthException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_OutOfRangeException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_RuntimeException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_OutOfBoundsException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_OverflowException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_RangeException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_UnderflowException_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_UnexpectedValueException_methods[] = { + ZEND_FE_END +}; + +static zend_class_entry *register_class_LogicException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "LogicException", class_LogicException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + +static zend_class_entry *register_class_BadFunctionCallException(zend_class_entry *class_entry_LogicException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "BadFunctionCallException", class_BadFunctionCallException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_LogicException); + + return class_entry; +} + +static zend_class_entry *register_class_BadMethodCallException(zend_class_entry *class_entry_BadFunctionCallException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "BadMethodCallException", class_BadMethodCallException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_BadFunctionCallException); + + return class_entry; +} + +static zend_class_entry *register_class_DomainException(zend_class_entry *class_entry_LogicException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "DomainException", class_DomainException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_LogicException); + + return class_entry; +} + +static zend_class_entry *register_class_InvalidArgumentException(zend_class_entry *class_entry_LogicException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "InvalidArgumentException", class_InvalidArgumentException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_LogicException); + + return class_entry; +} + +static zend_class_entry *register_class_LengthException(zend_class_entry *class_entry_LogicException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "LengthException", class_LengthException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_LogicException); + + return class_entry; +} + +static zend_class_entry *register_class_OutOfRangeException(zend_class_entry *class_entry_LogicException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OutOfRangeException", class_OutOfRangeException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_LogicException); + + return class_entry; +} + +static zend_class_entry *register_class_RuntimeException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RuntimeException", class_RuntimeException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + +static zend_class_entry *register_class_OutOfBoundsException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OutOfBoundsException", class_OutOfBoundsException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} + +static zend_class_entry *register_class_OverflowException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OverflowException", class_OverflowException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} + +static zend_class_entry *register_class_RangeException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RangeException", class_RangeException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} + +static zend_class_entry *register_class_UnderflowException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "UnderflowException", class_UnderflowException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} + +static zend_class_entry *register_class_UnexpectedValueException(zend_class_entry *class_entry_RuntimeException) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "UnexpectedValueException", class_UnexpectedValueException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException); + + return class_entry; +} diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index ea5e6ee984..d3726b4c3f 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -838,7 +838,11 @@ zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *ob PHP_MINIT_FUNCTION(spl_fixedarray) { - REGISTER_SPL_STD_CLASS_EX(SplFixedArray, spl_fixedarray_new, class_SplFixedArray_methods); + spl_ce_SplFixedArray = register_class_SplFixedArray(zend_ce_aggregate, zend_ce_arrayaccess, zend_ce_countable); + spl_ce_SplFixedArray->create_object = spl_fixedarray_new; + spl_ce_SplFixedArray->get_iterator = spl_fixedarray_get_iterator; + spl_ce_SplFixedArray->ce_flags |= ZEND_ACC_REUSE_GET_ITERATOR; + memcpy(&spl_handler_SplFixedArray, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_SplFixedArray.offset = XtOffsetOf(spl_fixedarray_object, std); @@ -853,12 +857,5 @@ PHP_MINIT_FUNCTION(spl_fixedarray) spl_handler_SplFixedArray.dtor_obj = zend_objects_destroy_object; spl_handler_SplFixedArray.free_obj = spl_fixedarray_object_free_storage; - REGISTER_SPL_IMPLEMENTS(SplFixedArray, Aggregate); - REGISTER_SPL_IMPLEMENTS(SplFixedArray, ArrayAccess); - REGISTER_SPL_IMPLEMENTS(SplFixedArray, Countable); - - spl_ce_SplFixedArray->get_iterator = spl_fixedarray_get_iterator; - spl_ce_SplFixedArray->ce_flags |= ZEND_ACC_REUSE_GET_ITERATOR; - return SUCCESS; } diff --git a/ext/spl/spl_fixedarray.stub.php b/ext/spl/spl_fixedarray.stub.php index f2bb378f7a..32489d7199 100644 --- a/ext/spl/spl_fixedarray.stub.php +++ b/ext/spl/spl_fixedarray.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class SplFixedArray implements IteratorAggregate, ArrayAccess, Countable { diff --git a/ext/spl/spl_fixedarray_arginfo.h b/ext/spl/spl_fixedarray_arginfo.h index 6067a3ebde..627400cb4d 100644 --- a/ext/spl/spl_fixedarray_arginfo.h +++ b/ext/spl/spl_fixedarray_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 831fe70055eb62135ae49321e5e5f3fe08c3d95f */ + * Stub hash: aeac254f38638c19a11f7d79ac2e5c2d40924e58 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size, IS_LONG, 0, "0") @@ -69,3 +69,14 @@ static const zend_function_entry class_SplFixedArray_methods[] = { ZEND_ME(SplFixedArray, getIterator, arginfo_class_SplFixedArray_getIterator, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_SplFixedArray(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplFixedArray", class_SplFixedArray_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 3, class_entry_IteratorAggregate, class_entry_ArrayAccess, class_entry_Countable); + + return class_entry; +} diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 946f6e0ad9..61ca426312 100644 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -23,55 +23,6 @@ #include "ext/standard/info.h" #include "php_spl.h" -/* {{{ spl_register_interface */ -void spl_register_interface(zend_class_entry ** ppce, char * class_name, const zend_function_entry * functions) -{ - zend_class_entry ce; - - INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), functions); - *ppce = zend_register_internal_interface(&ce); -} -/* }}} */ - -/* {{{ spl_register_std_class */ -PHPAPI void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void * obj_ctor, const zend_function_entry * function_list) -{ - zend_class_entry ce; - - INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list); - *ppce = zend_register_internal_class(&ce); - - /* entries changed by initialize */ - if (obj_ctor) { - (*ppce)->create_object = obj_ctor; - } -} -/* }}} */ - -/* {{{ spl_register_sub_class */ -PHPAPI void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, void *obj_ctor, const zend_function_entry * function_list) -{ - zend_class_entry ce; - - INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list); - *ppce = zend_register_internal_class_ex(&ce, parent_ce); - - /* entries changed by initialize */ - if (obj_ctor) { - (*ppce)->create_object = obj_ctor; - } else { - (*ppce)->create_object = parent_ce->create_object; - } -} -/* }}} */ - -/* {{{ spl_register_property */ -void spl_register_property( zend_class_entry * class_entry, char *prop_name, int prop_name_len, int prop_flags) -{ - zend_declare_property_null(class_entry, prop_name, prop_name_len, prop_flags); -} -/* }}} */ - /* {{{ spl_add_class_name */ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags) { diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index b1f0653607..576117c4c8 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -21,36 +21,9 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type); -#define REGISTER_SPL_STD_CLASS(class_name, obj_ctor) \ - spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, NULL); - -#define REGISTER_SPL_STD_CLASS_EX(class_name, obj_ctor, funcs) \ - spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, funcs); - -#define REGISTER_SPL_SUB_CLASS_EX(class_name, parent_class_name, obj_ctor, funcs) \ - spl_register_sub_class(&spl_ce_ ## class_name, spl_ce_ ## parent_class_name, # class_name, obj_ctor, funcs); - -#define REGISTER_SPL_INTERFACE(class_name) \ - spl_register_interface(&spl_ce_ ## class_name, # class_name, class_ ## class_name ## _methods); - -#define REGISTER_SPL_IMPLEMENTS(class_name, interface_name) \ - zend_class_implements(spl_ce_ ## class_name, 1, spl_ce_ ## interface_name); - -#define REGISTER_SPL_ITERATOR(class_name) \ - zend_class_implements(spl_ce_ ## class_name, 1, zend_ce_iterator); - -#define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \ - spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags); - #define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \ zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (zend_long)value); -void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list); -void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list); -void spl_register_interface(zend_class_entry ** ppce, char * class_name, const zend_function_entry *functions); - -void spl_register_property( zend_class_entry * class_entry, char *prop_name, int prop_name_len, int prop_flags); - /* sub: whether to allow subclasses/interfaces allow = 0: allow all classes and interfaces allow > 0: allow all that match and mask ce_flags diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index ba1b0fd681..61a24f8b3b 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -1113,7 +1113,10 @@ zend_object_iterator *spl_pqueue_get_iterator(zend_class_entry *ce, zval *object PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ { - REGISTER_SPL_STD_CLASS_EX(SplHeap, spl_heap_object_new, class_SplHeap_methods); + spl_ce_SplHeap = register_class_SplHeap(zend_ce_iterator, zend_ce_countable); + spl_ce_SplHeap->create_object = spl_heap_object_new; + spl_ce_SplHeap->get_iterator = spl_heap_get_iterator; + memcpy(&spl_handler_SplHeap, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_SplHeap.offset = XtOffsetOf(spl_heap_object, std); @@ -1123,18 +1126,18 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_handler_SplHeap.dtor_obj = zend_objects_destroy_object; spl_handler_SplHeap.free_obj = spl_heap_object_free_storage; - REGISTER_SPL_IMPLEMENTS(SplHeap, Iterator); - REGISTER_SPL_IMPLEMENTS(SplHeap, Countable); - - spl_ce_SplHeap->get_iterator = spl_heap_get_iterator; - - REGISTER_SPL_SUB_CLASS_EX(SplMinHeap, SplHeap, spl_heap_object_new, class_SplMinHeap_methods); - REGISTER_SPL_SUB_CLASS_EX(SplMaxHeap, SplHeap, spl_heap_object_new, class_SplMaxHeap_methods); + spl_ce_SplMinHeap = register_class_SplMinHeap(spl_ce_SplHeap); + spl_ce_SplMinHeap->create_object = spl_heap_object_new; + spl_ce_SplMinHeap->get_iterator = spl_heap_get_iterator; + spl_ce_SplMaxHeap = register_class_SplMaxHeap(spl_ce_SplHeap); + spl_ce_SplMaxHeap->create_object = spl_heap_object_new; spl_ce_SplMaxHeap->get_iterator = spl_heap_get_iterator; - spl_ce_SplMinHeap->get_iterator = spl_heap_get_iterator; - REGISTER_SPL_STD_CLASS_EX(SplPriorityQueue, spl_heap_object_new, class_SplPriorityQueue_methods); + spl_ce_SplPriorityQueue = register_class_SplPriorityQueue(zend_ce_iterator, zend_ce_countable); + spl_ce_SplPriorityQueue->create_object = spl_heap_object_new; + spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; + memcpy(&spl_handler_SplPriorityQueue, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_SplPriorityQueue.offset = XtOffsetOf(spl_heap_object, std); @@ -1144,11 +1147,6 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_handler_SplPriorityQueue.dtor_obj = zend_objects_destroy_object; spl_handler_SplPriorityQueue.free_obj = spl_heap_object_free_storage; - REGISTER_SPL_IMPLEMENTS(SplPriorityQueue, Iterator); - REGISTER_SPL_IMPLEMENTS(SplPriorityQueue, Countable); - - spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); diff --git a/ext/spl/spl_heap.stub.php b/ext/spl/spl_heap.stub.php index 8c01068eae..2f31ded011 100644 --- a/ext/spl/spl_heap.stub.php +++ b/ext/spl/spl_heap.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class SplPriorityQueue implements Iterator, Countable { diff --git a/ext/spl/spl_heap_arginfo.h b/ext/spl/spl_heap_arginfo.h index aede7a3daf..2afc289a1e 100644 --- a/ext/spl/spl_heap_arginfo.h +++ b/ext/spl/spl_heap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 510a58000a5473c4cbb33886f43b9f3050b3a36d */ + * Stub hash: 9a733260823a95ba1ab987154e23d72b6210999d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplPriorityQueue_compare, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, priority1, IS_MIXED, 0) @@ -155,3 +155,46 @@ static const zend_function_entry class_SplMaxHeap_methods[] = { ZEND_ME(SplMaxHeap, compare, arginfo_class_SplMaxHeap_compare, ZEND_ACC_PROTECTED) ZEND_FE_END }; + +static zend_class_entry *register_class_SplPriorityQueue(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplPriorityQueue", class_SplPriorityQueue_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_Countable); + + return class_entry; +} + +static zend_class_entry *register_class_SplHeap(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplHeap", class_SplHeap_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_ABSTRACT; + zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_Countable); + + return class_entry; +} + +static zend_class_entry *register_class_SplMinHeap(zend_class_entry *class_entry_SplHeap) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplMinHeap", class_SplMinHeap_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplHeap); + + return class_entry; +} + +static zend_class_entry *register_class_SplMaxHeap(zend_class_entry *class_entry_SplHeap) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplMaxHeap", class_SplMaxHeap_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_SplHeap); + + return class_entry; +} diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index a4531f6056..71b8fb69d4 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -3217,11 +3217,13 @@ PHP_FUNCTION(iterator_apply) /* {{{ PHP_MINIT_FUNCTION(spl_iterators) */ PHP_MINIT_FUNCTION(spl_iterators) { - REGISTER_SPL_INTERFACE(RecursiveIterator); - REGISTER_SPL_ITERATOR(RecursiveIterator); + spl_ce_RecursiveIterator = register_class_RecursiveIterator(zend_ce_iterator); - REGISTER_SPL_STD_CLASS_EX(RecursiveIteratorIterator, spl_RecursiveIteratorIterator_new, class_RecursiveIteratorIterator_methods); - REGISTER_SPL_ITERATOR(RecursiveIteratorIterator); + spl_ce_OuterIterator = register_class_OuterIterator(zend_ce_iterator); + + spl_ce_RecursiveIteratorIterator = register_class_RecursiveIteratorIterator(spl_ce_OuterIterator); + spl_ce_RecursiveIteratorIterator->create_object = spl_RecursiveIteratorIterator_new; + spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator; memcpy(&spl_handlers_rec_it_it, &std_object_handlers, sizeof(zend_object_handlers)); spl_handlers_rec_it_it.offset = XtOffsetOf(spl_recursive_it_object, std); @@ -3238,43 +3240,36 @@ PHP_MINIT_FUNCTION(spl_iterators) spl_handlers_dual_it.free_obj = spl_dual_it_free_storage; spl_handlers_dual_it.get_gc = spl_dual_it_get_gc; - spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); - REGISTER_SPL_INTERFACE(OuterIterator); - REGISTER_SPL_ITERATOR(OuterIterator); - - REGISTER_SPL_STD_CLASS_EX(IteratorIterator, spl_dual_it_new, class_IteratorIterator_methods); - REGISTER_SPL_ITERATOR(IteratorIterator); - REGISTER_SPL_IMPLEMENTS(IteratorIterator, OuterIterator); + spl_ce_IteratorIterator = register_class_IteratorIterator(spl_ce_OuterIterator); + spl_ce_IteratorIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(FilterIterator, IteratorIterator, spl_dual_it_new, class_FilterIterator_methods); - spl_ce_FilterIterator->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; + spl_ce_FilterIterator = register_class_FilterIterator(spl_ce_IteratorIterator); + spl_ce_FilterIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(RecursiveFilterIterator, FilterIterator, spl_dual_it_new, class_RecursiveFilterIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveFilterIterator, RecursiveIterator); + spl_ce_RecursiveFilterIterator = register_class_RecursiveFilterIterator(spl_ce_FilterIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveFilterIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(CallbackFilterIterator, FilterIterator, spl_dual_it_new, class_CallbackFilterIterator_methods); + spl_ce_CallbackFilterIterator = register_class_CallbackFilterIterator(spl_ce_FilterIterator); + spl_ce_CallbackFilterIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(RecursiveCallbackFilterIterator, CallbackFilterIterator, spl_dual_it_new, class_RecursiveCallbackFilterIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveCallbackFilterIterator, RecursiveIterator); + spl_ce_RecursiveCallbackFilterIterator = register_class_RecursiveCallbackFilterIterator(spl_ce_CallbackFilterIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveCallbackFilterIterator->create_object = spl_dual_it_new; + spl_ce_ParentIterator = register_class_ParentIterator(spl_ce_RecursiveFilterIterator); + spl_ce_ParentIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(ParentIterator, RecursiveFilterIterator, spl_dual_it_new, class_ParentIterator_methods); + spl_ce_SeekableIterator = register_class_SeekableIterator(zend_ce_iterator); - REGISTER_SPL_INTERFACE(SeekableIterator); - REGISTER_SPL_ITERATOR(SeekableIterator); + spl_ce_LimitIterator = register_class_LimitIterator(spl_ce_IteratorIterator); + spl_ce_LimitIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(LimitIterator, IteratorIterator, spl_dual_it_new, class_LimitIterator_methods); - - REGISTER_SPL_SUB_CLASS_EX(CachingIterator, IteratorIterator, spl_dual_it_new, class_CachingIterator_methods); - REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess); - REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable); - REGISTER_SPL_IMPLEMENTS(CachingIterator, Stringable); + spl_ce_CachingIterator = register_class_CachingIterator(spl_ce_IteratorIterator, zend_ce_arrayaccess, zend_ce_countable, zend_ce_stringable); + spl_ce_CachingIterator->create_object = spl_dual_it_new; REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); @@ -3283,17 +3278,21 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); - REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, class_RecursiveCachingIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator); + spl_ce_RecursiveCachingIterator = register_class_RecursiveCachingIterator(spl_ce_CachingIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveCachingIterator->create_object = spl_dual_it_new; + + spl_ce_NoRewindIterator = register_class_NoRewindIterator(spl_ce_IteratorIterator); + spl_ce_NoRewindIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(NoRewindIterator, IteratorIterator, spl_dual_it_new, class_NoRewindIterator_methods); + spl_ce_AppendIterator = register_class_AppendIterator(spl_ce_IteratorIterator); + spl_ce_AppendIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(AppendIterator, IteratorIterator, spl_dual_it_new, class_AppendIterator_methods); + spl_ce_InfiniteIterator = register_class_InfiniteIterator(spl_ce_IteratorIterator); + spl_ce_InfiniteIterator->create_object = spl_dual_it_new; - REGISTER_SPL_IMPLEMENTS(RecursiveIteratorIterator, OuterIterator); + spl_ce_RegexIterator = register_class_RegexIterator(spl_ce_FilterIterator); + spl_ce_RegexIterator->create_object = spl_dual_it_new; - REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, class_InfiniteIterator_methods); - REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, class_RegexIterator_methods); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH); @@ -3301,14 +3300,15 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); - REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0); - REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, class_RecursiveRegexIterator_methods); - REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator); - REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, class_EmptyIterator_methods); - REGISTER_SPL_ITERATOR(EmptyIterator); + spl_ce_RecursiveRegexIterator = register_class_RecursiveRegexIterator(spl_ce_RegexIterator, spl_ce_RecursiveIterator); + spl_ce_RecursiveRegexIterator->create_object = spl_dual_it_new; + + spl_ce_EmptyIterator = register_class_EmptyIterator(zend_ce_iterator); + + spl_ce_RecursiveTreeIterator = register_class_RecursiveTreeIterator(spl_ce_RecursiveIteratorIterator); + spl_ce_RecursiveTreeIterator->create_object = spl_RecursiveTreeIterator_new; - REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, class_RecursiveTreeIterator_methods); REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT", 0); diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 8c611f946d..d733fb18a1 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -21,14 +21,6 @@ #include "php_spl.h" #include "ext/pcre/php_pcre.h" -#define spl_ce_Aggregate zend_ce_aggregate -#define spl_ce_ArrayAccess zend_ce_arrayaccess -#define spl_ce_Countable zend_ce_countable -#define spl_ce_Iterator zend_ce_iterator -#define spl_ce_Serializable zend_ce_serializable -#define spl_ce_Stringable zend_ce_stringable -#define spl_ce_Traversable zend_ce_traversable - extern PHPAPI zend_class_entry *spl_ce_AppendIterator; extern PHPAPI zend_class_entry *spl_ce_CachingIterator; extern PHPAPI zend_class_entry *spl_ce_CallbackFilterIterator; diff --git a/ext/spl/spl_iterators.stub.php b/ext/spl/spl_iterators.stub.php index 6a60b2acaf..2038fd6499 100644 --- a/ext/spl/spl_iterators.stub.php +++ b/ext/spl/spl_iterators.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ class EmptyIterator implements Iterator { @@ -198,7 +198,7 @@ class LimitIterator extends IteratorIterator public function getPosition() {} } -class CachingIterator extends IteratorIterator implements ArrayAccess, Countable +class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable { public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {} diff --git a/ext/spl/spl_iterators_arginfo.h b/ext/spl/spl_iterators_arginfo.h index 5039624996..71738cad89 100644 --- a/ext/spl/spl_iterators_arginfo.h +++ b/ext/spl/spl_iterators_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7d796a9f3df263d34cfe55070a09c4300e7d6765 */ + * Stub hash: a2f4e91b58d1af4954a2665a8fac10a4e0d9e31d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0) ZEND_END_ARG_INFO() @@ -591,3 +591,222 @@ static const zend_function_entry class_RecursiveTreeIterator_methods[] = { ZEND_ME(RecursiveTreeIterator, getPostfix, arginfo_class_RecursiveTreeIterator_getPostfix, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_EmptyIterator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "EmptyIterator", class_EmptyIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} + +static zend_class_entry *register_class_CallbackFilterIterator(zend_class_entry *class_entry_FilterIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "CallbackFilterIterator", class_CallbackFilterIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FilterIterator); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveCallbackFilterIterator(zend_class_entry *class_entry_CallbackFilterIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveCallbackFilterIterator", class_RecursiveCallbackFilterIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_CallbackFilterIterator); + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveIterator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveIterator", class_RecursiveIterator_methods); + class_entry = zend_register_internal_interface(&ce); + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveIteratorIterator(zend_class_entry *class_entry_OuterIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveIteratorIterator", class_RecursiveIteratorIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_OuterIterator); + + return class_entry; +} + +static zend_class_entry *register_class_OuterIterator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "OuterIterator", class_OuterIterator_methods); + class_entry = zend_register_internal_interface(&ce); + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} + +static zend_class_entry *register_class_IteratorIterator(zend_class_entry *class_entry_OuterIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "IteratorIterator", class_IteratorIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_OuterIterator); + + return class_entry; +} + +static zend_class_entry *register_class_FilterIterator(zend_class_entry *class_entry_IteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "FilterIterator", class_FilterIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + class_entry->ce_flags |= ZEND_ACC_ABSTRACT; + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveFilterIterator(zend_class_entry *class_entry_FilterIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveFilterIterator", class_RecursiveFilterIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FilterIterator); + class_entry->ce_flags |= ZEND_ACC_ABSTRACT; + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} + +static zend_class_entry *register_class_ParentIterator(zend_class_entry *class_entry_RecursiveFilterIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ParentIterator", class_ParentIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RecursiveFilterIterator); + + return class_entry; +} + +static zend_class_entry *register_class_SeekableIterator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SeekableIterator", class_SeekableIterator_methods); + class_entry = zend_register_internal_interface(&ce); + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} + +static zend_class_entry *register_class_LimitIterator(zend_class_entry *class_entry_IteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "LimitIterator", class_LimitIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + + return class_entry; +} + +static zend_class_entry *register_class_CachingIterator(zend_class_entry *class_entry_IteratorIterator, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_Countable, zend_class_entry *class_entry_Stringable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "CachingIterator", class_CachingIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + zend_class_implements(class_entry, 3, class_entry_ArrayAccess, class_entry_Countable, class_entry_Stringable); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveCachingIterator(zend_class_entry *class_entry_CachingIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveCachingIterator", class_RecursiveCachingIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_CachingIterator); + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} + +static zend_class_entry *register_class_NoRewindIterator(zend_class_entry *class_entry_IteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "NoRewindIterator", class_NoRewindIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + + return class_entry; +} + +static zend_class_entry *register_class_AppendIterator(zend_class_entry *class_entry_IteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "AppendIterator", class_AppendIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + + return class_entry; +} + +static zend_class_entry *register_class_InfiniteIterator(zend_class_entry *class_entry_IteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "InfiniteIterator", class_InfiniteIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_IteratorIterator); + + return class_entry; +} + +static zend_class_entry *register_class_RegexIterator(zend_class_entry *class_entry_FilterIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RegexIterator", class_RegexIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_FilterIterator); + + zval property_replacement_default_value; + ZVAL_NULL(&property_replacement_default_value); + zend_string *property_replacement_name = zend_string_init("replacement", sizeof("replacement") - 1, 1); + zend_declare_property_ex(class_entry, property_replacement_name, &property_replacement_default_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(property_replacement_name); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveRegexIterator(zend_class_entry *class_entry_RegexIterator, zend_class_entry *class_entry_RecursiveIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveRegexIterator", class_RecursiveRegexIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RegexIterator); + zend_class_implements(class_entry, 1, class_entry_RecursiveIterator); + + return class_entry; +} + +static zend_class_entry *register_class_RecursiveTreeIterator(zend_class_entry *class_entry_RecursiveIteratorIterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "RecursiveTreeIterator", class_RecursiveTreeIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_RecursiveIteratorIterator); + + return class_entry; +} diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 3fd50ceb89..999c54d1f4 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -1190,10 +1190,12 @@ PHP_METHOD(MultipleIterator, key) /* {{{ PHP_MINIT_FUNCTION(spl_observer) */ PHP_MINIT_FUNCTION(spl_observer) { - REGISTER_SPL_INTERFACE(SplObserver); - REGISTER_SPL_INTERFACE(SplSubject); + spl_ce_SplObserver = register_class_SplObserver(); + spl_ce_SplSubject = register_class_SplSubject(); + + spl_ce_SplObjectStorage = register_class_SplObjectStorage(zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_arrayaccess); + spl_ce_SplObjectStorage->create_object = spl_SplObjectStorage_new; - REGISTER_SPL_STD_CLASS_EX(SplObjectStorage, spl_SplObjectStorage_new, class_SplObjectStorage_methods); memcpy(&spl_handler_SplObjectStorage, &std_object_handlers, sizeof(zend_object_handlers)); spl_handler_SplObjectStorage.offset = XtOffsetOf(spl_SplObjectStorage, std); @@ -1203,13 +1205,8 @@ PHP_MINIT_FUNCTION(spl_observer) spl_handler_SplObjectStorage.dtor_obj = zend_objects_destroy_object; spl_handler_SplObjectStorage.free_obj = spl_SplObjectStorage_free_storage; - REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Countable); - REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Iterator); - REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Serializable); - REGISTER_SPL_IMPLEMENTS(SplObjectStorage, ArrayAccess); - - REGISTER_SPL_STD_CLASS_EX(MultipleIterator, spl_SplObjectStorage_new, class_MultipleIterator_methods); - REGISTER_SPL_ITERATOR(MultipleIterator); + spl_ce_MultipleIterator = register_class_MultipleIterator(zend_ce_iterator); + spl_ce_MultipleIterator->create_object = spl_SplObjectStorage_new; REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); diff --git a/ext/spl/spl_observer.stub.php b/ext/spl/spl_observer.stub.php index b7b423e984..4baab933ef 100644 --- a/ext/spl/spl_observer.stub.php +++ b/ext/spl/spl_observer.stub.php @@ -1,6 +1,6 @@ <?php -/** @generate-function-entries */ +/** @generate-class-entries */ interface SplObserver { diff --git a/ext/spl/spl_observer_arginfo.h b/ext/spl/spl_observer_arginfo.h index f802c2a5a8..007ecbe208 100644 --- a/ext/spl/spl_observer_arginfo.h +++ b/ext/spl/spl_observer_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fdcb6eb431f6accdb8e44ecc735ae563a5651edf */ + * Stub hash: a469366b28d26706862ecddae69497fe3e06f137 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplObserver_update, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0) @@ -212,3 +212,45 @@ static const zend_function_entry class_MultipleIterator_methods[] = { ZEND_MALIAS(SplObjectStorage, __debugInfo, __debugInfo, arginfo_class_MultipleIterator___debugInfo, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_SplObserver(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplObserver", class_SplObserver_methods); + class_entry = zend_register_internal_interface(&ce); + + return class_entry; +} + +static zend_class_entry *register_class_SplSubject(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplSubject", class_SplSubject_methods); + class_entry = zend_register_internal_interface(&ce); + + return class_entry; +} + +static zend_class_entry *register_class_SplObjectStorage(zend_class_entry *class_entry_Countable, zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_ArrayAccess) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "SplObjectStorage", class_SplObjectStorage_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 4, class_entry_Countable, class_entry_Iterator, class_entry_Serializable, class_entry_ArrayAccess); + + return class_entry; +} + +static zend_class_entry *register_class_MultipleIterator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "MultipleIterator", class_MultipleIterator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} |
