diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 991fa88ded6..4098382c61c 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -177,11 +177,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_o } while (parent) { - if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator) { - intern->std.handlers = &spl_handler_ArrayIterator; - break; - } else if (parent == spl_ce_ArrayObject) { - intern->std.handlers = &spl_handler_ArrayObject; + if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator || parent == spl_ce_ArrayObject) { break; } parent = parent->parent; @@ -1781,6 +1777,7 @@ PHP_MINIT_FUNCTION(spl_array) { 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; + spl_ce_ArrayObject->default_object_handlers = &spl_handler_ArrayObject; memcpy(&spl_handler_ArrayObject, &std_object_handlers, sizeof(zend_object_handlers)); @@ -1806,6 +1803,7 @@ PHP_MINIT_FUNCTION(spl_array) 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->default_object_handlers = &spl_handler_ArrayIterator; spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator; memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 186b9a34c7e..a3c17d59668 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -344,14 +344,11 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_ while (parent) { if (parent == spl_ce_SplStack) { intern->flags |= (SPL_DLLIST_IT_FIX | SPL_DLLIST_IT_LIFO); - intern->std.handlers = &spl_handler_SplDoublyLinkedList; } else if (parent == spl_ce_SplQueue) { intern->flags |= SPL_DLLIST_IT_FIX; - intern->std.handlers = &spl_handler_SplDoublyLinkedList; } if (parent == spl_ce_SplDoublyLinkedList) { - intern->std.handlers = &spl_handler_SplDoublyLinkedList; break; } @@ -1257,6 +1254,7 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ zend_ce_iterator, zend_ce_countable, zend_ce_arrayaccess, zend_ce_serializable ); spl_ce_SplDoublyLinkedList->create_object = spl_dllist_object_new; + spl_ce_SplDoublyLinkedList->default_object_handlers = &spl_handler_SplDoublyLinkedList; spl_ce_SplDoublyLinkedList->get_iterator = spl_dllist_get_iterator; memcpy(&spl_handler_SplDoublyLinkedList, &std_object_handlers, sizeof(zend_object_handlers)); diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index a00bb8965af..5c013408ea9 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -282,7 +282,6 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z while (parent) { if (parent == spl_ce_SplFixedArray) { - intern->std.handlers = &spl_handler_SplFixedArray; break; } @@ -959,6 +958,7 @@ PHP_MINIT_FUNCTION(spl_fixedarray) spl_ce_SplFixedArray = register_class_SplFixedArray( zend_ce_aggregate, zend_ce_arrayaccess, zend_ce_countable, php_json_serializable_ce); spl_ce_SplFixedArray->create_object = spl_fixedarray_new; + spl_ce_SplFixedArray->default_object_handlers = &spl_handler_SplFixedArray; spl_ce_SplFixedArray->get_iterator = spl_fixedarray_get_iterator; memcpy(&spl_handler_SplFixedArray, &std_object_handlers, sizeof(zend_object_handlers)); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index db35511f08d..64fe962ee2d 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -428,7 +428,6 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_ob while (parent) { if (parent == spl_ce_SplPriorityQueue) { intern->heap = spl_ptr_heap_init(spl_ptr_pqueue_elem_cmp, spl_ptr_heap_pqueue_elem_ctor, spl_ptr_heap_pqueue_elem_dtor, sizeof(spl_pqueue_elem)); - intern->std.handlers = &spl_handler_SplPriorityQueue; intern->flags = SPL_PQUEUE_EXTR_DATA; break; } @@ -438,7 +437,6 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_ob intern->heap = spl_ptr_heap_init( parent == spl_ce_SplMinHeap ? spl_ptr_heap_zval_min_cmp : spl_ptr_heap_zval_max_cmp, spl_ptr_heap_zval_ctor, spl_ptr_heap_zval_dtor, sizeof(zval)); - intern->std.handlers = &spl_handler_SplHeap; break; } @@ -1129,6 +1127,7 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ { spl_ce_SplHeap = register_class_SplHeap(zend_ce_iterator, zend_ce_countable); spl_ce_SplHeap->create_object = spl_heap_object_new; + spl_ce_SplHeap->default_object_handlers = &spl_handler_SplHeap; spl_ce_SplHeap->get_iterator = spl_heap_get_iterator; memcpy(&spl_handler_SplHeap, &std_object_handlers, sizeof(zend_object_handlers)); @@ -1149,6 +1148,7 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_ce_SplPriorityQueue = register_class_SplPriorityQueue(zend_ce_iterator, zend_ce_countable); spl_ce_SplPriorityQueue->create_object = spl_heap_object_new; + spl_ce_SplPriorityQueue->default_object_handlers = &spl_handler_SplPriorityQueue; spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; memcpy(&spl_handler_SplPriorityQueue, &std_object_handlers, sizeof(zend_object_handlers));