/* {{{ proto array SplDoublyLinkedList::__serialize() */ SPL_METHOD(SplDoublyLinkedList, __serialize) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); spl_ptr_llist_element *current = intern->llist->head; zval tmp; if (zend_parse_parameters_none_throw() == FAILURE) { return; } array_init(return_value); /* flags */ ZVAL_LONG(&tmp, intern->flags); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp); /* elements */ array_init_size(&tmp, intern->llist->count); while (current) { zend_hash_next_index_insert(Z_ARRVAL(tmp), ¤t->data); current = current->next; } zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp); /* members */ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std)); Z_TRY_ADDREF(tmp); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp); } /* }}} */
zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */ { spl_dllist_it *iterator; spl_dllist_object *dllist_object = Z_SPLDLLIST_P(object); if (by_ref) { zend_throw_exception(spl_ce_RuntimeException, "An iterator cannot be used with foreach by reference", 0); return NULL; } iterator = emalloc(sizeof(spl_dllist_it)); zend_iterator_init((zend_object_iterator*)iterator); ZVAL_COPY(&iterator->intern.it.data, object); iterator->intern.it.funcs = &spl_dllist_it_funcs; iterator->intern.ce = ce; iterator->traverse_position = dllist_object->traverse_position; iterator->traverse_pointer = dllist_object->traverse_pointer; iterator->flags = dllist_object->flags & SPL_DLLIST_IT_MASK; ZVAL_UNDEF(&iterator->intern.value); SPL_LLIST_CHECK_ADDREF(iterator->traverse_pointer); return &iterator->intern.it; }
/* {{{ proto void SplDoublyLinkedList::__unserialize(array serialized) */ SPL_METHOD(SplDoublyLinkedList, __unserialize) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); HashTable *data; zval *flags_zv, *storage_zv, *members_zv, *elem; if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "h", &data) == FAILURE) { return; } flags_zv = zend_hash_index_find(data, 0); storage_zv = zend_hash_index_find(data, 1); members_zv = zend_hash_index_find(data, 2); if (!flags_zv || !storage_zv || !members_zv || Z_TYPE_P(flags_zv) != IS_LONG || Z_TYPE_P(storage_zv) != IS_ARRAY || Z_TYPE_P(members_zv) != IS_ARRAY) { zend_throw_exception(spl_ce_UnexpectedValueException, "Incomplete or ill-typed serialization data", 0); return; } intern->flags = (int) Z_LVAL_P(flags_zv); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(storage_zv), elem) { spl_ptr_llist_push(intern->llist, elem); } ZEND_HASH_FOREACH_END();
/* {{{ proto mixed SplDoublyLinkedList::offsetGet(mixed index) Returns the value at the specified $index. */ SPL_METHOD(SplDoublyLinkedList, offsetGet) { zval *zindex; zend_long index; spl_dllist_object *intern; spl_ptr_llist_element *element; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); index = spl_offset_convert_to_long(zindex); if (index < 0 || index >= intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0); return; } element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); if (element != NULL) { zval *value = &element->data; ZVAL_COPY_DEREF(return_value, value); } else { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0); } } /* }}} */
static void spl_dllist_it_rewind(zend_object_iterator *iter) /* {{{ */ { spl_dllist_it *iterator = (spl_dllist_it *)iter; spl_dllist_object *object = Z_SPLDLLIST_P(&iter->data); spl_ptr_llist *llist = object->llist; spl_dllist_it_helper_rewind(&iterator->traverse_pointer, &iterator->traverse_position, llist, object->flags); }
/* {{{ proto void SplDoublyLinkedList::unserialize(string serialized) Unserializes storage */ SPL_METHOD(SplDoublyLinkedList, unserialize) { spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); zval flags, elem; char *buf; size_t buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &buf, &buf_len) == FAILURE) { return; } if (buf_len == 0) { return; } s = p = (const unsigned char*)buf; PHP_VAR_UNSERIALIZE_INIT(var_hash); /* flags */ if (!php_var_unserialize(&flags, &p, s + buf_len, &var_hash)) { goto error; } if (Z_TYPE(flags) != IS_LONG) { zval_ptr_dtor(&flags); goto error; } intern->flags = (int)Z_LVAL(flags); zval_ptr_dtor(&flags); /* elements */ while(*p == ':') { ++p; if (!php_var_unserialize(&elem, &p, s + buf_len, &var_hash)) { goto error; } spl_ptr_llist_push(intern->llist, &elem); zval_ptr_dtor(&elem); } if (*p != '\0') { goto error; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return; error: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len); return; } /* }}} */
static void spl_dllist_it_move_forward(zend_object_iterator *iter) /* {{{ */ { spl_dllist_it *iterator = (spl_dllist_it *)iter; spl_dllist_object *object = Z_SPLDLLIST_P(&iter->data); zend_user_it_invalidate_current(iter); spl_dllist_it_helper_move_forward(&iterator->traverse_pointer, &iterator->traverse_position, object->llist, object->flags); }
/* {{{ proto bool SplDoublyLinkedList::valid() Check whether the datastructure contains more entries */ SPL_METHOD(SplDoublyLinkedList, valid) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(intern->traverse_pointer != NULL); }
/* {{{ proto void SplDoublyLinkedList::next() Move to next entry */ SPL_METHOD(SplDoublyLinkedList, next) { spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags); }
/* {{{ proto int SplDoublyLinkedList::key() Return current array key */ SPL_METHOD(SplDoublyLinkedList, key) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_LONG(intern->traverse_position); }
/* {{{ proto void SplDoublyLinkedList::prev() Move to next entry */ SPL_METHOD(SplDoublyLinkedList, prev) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); if (zend_parse_parameters_none() == FAILURE) { return; } spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ SPL_DLLIST_IT_LIFO); }
/* {{{ proto void SplDoublyLinkedList::rewind() Rewind the datastructure back to the start */ SPL_METHOD(SplDoublyLinkedList, rewind) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); if (zend_parse_parameters_none() == FAILURE) { return; } spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags); }
/* {{{ proto int SplDoublyLinkedList::getIteratorMode() Return the mode of iteration */ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) { spl_dllist_object *intern; if (zend_parse_parameters_none() == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); RETURN_LONG(intern->flags); }
/* {{{ proto int SplDoublyLinkedList::count() Return the number of elements in the datastructure. */ SPL_METHOD(SplDoublyLinkedList, count) { zend_long count; spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); if (zend_parse_parameters_none() == FAILURE) { return; } count = spl_ptr_llist_count(intern->llist); RETURN_LONG(count); }
/* {{{ proto void SplDoublyLinkedList::add(mixed $index, mixed $newval) Inserts a new entry before the specified $index consisting of $newval. */ SPL_METHOD(SplDoublyLinkedList, add) { zval *zindex, *value; spl_dllist_object *intern; spl_ptr_llist_element *element; zend_long index; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zindex, &value) == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); index = spl_offset_convert_to_long(zindex); if (index < 0 || index > intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0); return; } if (Z_REFCOUNTED_P(value)) { Z_ADDREF_P(value); } if (index == intern->llist->count) { /* If index is the last entry+1 then we do a push because we're not inserting before any entry */ spl_ptr_llist_push(intern->llist, value); } else { /* Create the new element we want to insert */ spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element)); /* Get the element we want to insert before */ element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); ZVAL_COPY_VALUE(&elem->data, value); elem->rc = 1; /* connect to the neighbours */ elem->next = element; elem->prev = element->prev; /* connect the neighbours to this new element */ if (elem->prev == NULL) { intern->llist->head = elem; } else { element->prev->next = elem; } element->prev = elem; intern->llist->count++; if (intern->llist->ctor) { intern->llist->ctor(elem); } } } /* }}} */
/* {{{ proto void SplDoublyLinkedList::offsetSet(mixed $index, mixed $newval) Sets the value at the specified $index to $newval. */ SPL_METHOD(SplDoublyLinkedList, offsetSet) { zval *zindex, *value; spl_dllist_object *intern; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zindex, &value) == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); if (Z_TYPE_P(zindex) == IS_NULL) { /* $obj[] = ... */ spl_ptr_llist_push(intern->llist, value); } else { /* $obj[$foo] = ... */ zend_long index; spl_ptr_llist_element *element; index = spl_offset_convert_to_long(zindex); if (index < 0 || index >= intern->llist->count) { zval_ptr_dtor(value); zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0); return; } element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); if (element != NULL) { /* call dtor on the old element as in spl_ptr_llist_pop */ if (intern->llist->dtor) { intern->llist->dtor(element); } /* the element is replaced, delref the old one as in * SplDoublyLinkedList::pop() */ zval_ptr_dtor(&element->data); ZVAL_COPY_VALUE(&element->data, value); /* new element, call ctor as in spl_ptr_llist_push */ if (intern->llist->ctor) { intern->llist->ctor(element); } } else { zval_ptr_dtor(value); zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0); return; } } } /* }}} */
/* {{{ proto bool SplDoublyLinkedList::unshift(mixed value) Unshift $value on the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, unshift) { zval *value; spl_dllist_object *intern; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); spl_ptr_llist_unshift(intern->llist, value); RETURN_TRUE; }
/* {{{ proto mixed|NULL SplDoublyLinkedList::current() Return current datastructure entry */ SPL_METHOD(SplDoublyLinkedList, current) { spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); spl_ptr_llist_element *element = intern->traverse_pointer; if (zend_parse_parameters_none() == FAILURE) { return; } if (element == NULL || Z_ISUNDEF(element->data)) { RETURN_NULL(); } else { RETURN_ZVAL(&element->data, 1, 0); } }
/* {{{ proto bool SplDoublyLinkedList::offsetExists(mixed index) Returns whether the requested $index exists. */ SPL_METHOD(SplDoublyLinkedList, offsetExists) { zval *zindex; spl_dllist_object *intern; zend_long index; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); index = spl_offset_convert_to_long(zindex); RETURN_BOOL(index >= 0 && index < intern->llist->count); } /* }}} */
static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(obj); spl_ptr_llist_element *current = intern->llist->head, *next; zval tmp, dllist_array; zend_string *pnstr; int i = 0; *is_temp = 0; if (intern->debug_info == NULL) { ALLOC_HASHTABLE(intern->debug_info); zend_hash_init(intern->debug_info, 1, NULL, ZVAL_PTR_DTOR, 0); } if (intern->debug_info->u.v.nApplyCount == 0) { if (!intern->std.properties) { rebuild_object_properties(&intern->std); } zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1); ZVAL_LONG(&tmp, intern->flags); zend_hash_add(intern->debug_info, pnstr, &tmp); zend_string_release(pnstr); array_init(&dllist_array); while (current) { next = current->next; add_index_zval(&dllist_array, i, ¤t->data); if (Z_REFCOUNTED(current->data)) { Z_ADDREF(current->data); } i++; current = next; } pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1); zend_hash_add(intern->debug_info, pnstr, &dllist_array); zend_string_release(pnstr); } return intern->debug_info; }
/* {{{ proto mixed SplDoublyLinkedList::shift() Shift an element out of the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, shift) { spl_dllist_object *intern; if (zend_parse_parameters_none() == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); spl_ptr_llist_shift(intern->llist, return_value); if (Z_ISUNDEF_P(return_value)) { zend_throw_exception(spl_ce_RuntimeException, "Can't shift from an empty datastructure", 0); RETURN_NULL(); } }
/* {{{ proto mixed|NULL SplDoublyLinkedList::current() Return current datastructure entry */ SPL_METHOD(SplDoublyLinkedList, current) { spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); spl_ptr_llist_element *element = intern->traverse_pointer; if (zend_parse_parameters_none() == FAILURE) { return; } if (element == NULL || Z_ISUNDEF(element->data)) { RETURN_NULL(); } else { zval *value = &element->data; ZVAL_COPY_DEREF(return_value, value); } }
static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(object); if (intern->fptr_count) { zval rv; zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); return SUCCESS; } *count = 0; return FAILURE; } *count = spl_ptr_llist_count(intern->llist); return SUCCESS; }
/* {{{ proto mixed SplDoublyLinkedList::top() Peek at the top element of the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, top) { zval *value; spl_dllist_object *intern; if (zend_parse_parameters_none() == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); value = spl_ptr_llist_last(intern->llist); if (value == NULL || Z_ISUNDEF_P(value)) { zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0); return; } RETURN_ZVAL(value, 1, 0); }
/* {{{ proto mixed SplDoublyLinkedList::bottom() Peek at the bottom element of the SplDoublyLinkedList */ SPL_METHOD(SplDoublyLinkedList, bottom) { zval *value; spl_dllist_object *intern; if (zend_parse_parameters_none() == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); value = spl_ptr_llist_first(intern->llist); if (value == NULL || Z_ISUNDEF_P(value)) { zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0); return; } ZVAL_COPY_DEREF(return_value, value); }
static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(obj); spl_ptr_llist_element *current = intern->llist->head; int i = 0; if (intern->gc_data_count < intern->llist->count) { intern->gc_data_count = intern->llist->count; intern->gc_data = safe_erealloc(intern->gc_data, intern->gc_data_count, sizeof(zval), 0); } while (current) { ZVAL_COPY_VALUE(&intern->gc_data[i++], ¤t->data); current = current->next; } *gc_data = intern->gc_data; *gc_data_count = i; return zend_std_get_properties(obj); }
/* {{{ proto string SplDoublyLinkedList::serialize() Serializes storage */ SPL_METHOD(SplDoublyLinkedList, serialize) { spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); smart_str buf = {0}; spl_ptr_llist_element *current = intern->llist->head, *next; zval flags; php_serialize_data_t var_hash; if (zend_parse_parameters_none() == FAILURE) { return; } PHP_VAR_SERIALIZE_INIT(var_hash); /* flags */ ZVAL_LONG(&flags, intern->flags); php_var_serialize(&buf, &flags, &var_hash); zval_ptr_dtor(&flags); /* elements */ while (current) { smart_str_appendc(&buf, ':'); next = current->next; php_var_serialize(&buf, ¤t->data, &var_hash); current = next; } smart_str_0(&buf); /* done */ PHP_VAR_SERIALIZE_DESTROY(var_hash); if (buf.s) { RETURN_STR(buf.s); } else { RETURN_NULL(); } } /* }}} */
/* {{{ proto int SplDoublyLinkedList::setIteratorMode(int mode) Set the mode of iteration */ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) { zend_long value; spl_dllist_object *intern; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); if (intern->flags & SPL_DLLIST_IT_FIX && (intern->flags & SPL_DLLIST_IT_LIFO) != (value & SPL_DLLIST_IT_LIFO)) { zend_throw_exception(spl_ce_RuntimeException, "Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen", 0); return; } intern->flags = (value & SPL_DLLIST_IT_MASK) | (intern->flags & SPL_DLLIST_IT_FIX); RETURN_LONG(intern->flags); }
/* {{{ proto void SplDoublyLinkedList::offsetUnset(mixed index) Unsets the value at the specified $index. */ SPL_METHOD(SplDoublyLinkedList, offsetUnset) { zval *zindex; zend_long index; spl_dllist_object *intern; spl_ptr_llist_element *element; spl_ptr_llist *llist; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) { return; } intern = Z_SPLDLLIST_P(ZEND_THIS); index = spl_offset_convert_to_long(zindex); llist = intern->llist; if (index < 0 || index >= intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0); return; } element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); if (element != NULL) { /* connect the neightbors */ if (element->prev) { element->prev->next = element->next; } if (element->next) { element->next->prev = element->prev; } /* take care of head/tail */ if (element == llist->head) { llist->head = element->next; } if (element == llist->tail) { llist->tail = element->prev; } /* finally, delete the element */ llist->count--; if(llist->dtor) { llist->dtor(element); } if (intern->traverse_pointer == element) { SPL_LLIST_DELREF(element); intern->traverse_pointer = NULL; } zval_ptr_dtor(&element->data); ZVAL_UNDEF(&element->data); SPL_LLIST_DELREF(element); } else { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0); return; } } /* }}} */
static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */ { spl_dllist_object *intern; zend_class_entry *parent = class_type; int inherited = 0; intern = ecalloc(1, sizeof(spl_dllist_object) + sizeof(zval) * (parent->default_properties_count - 1)); zend_object_std_init(&intern->std, class_type); object_properties_init(&intern->std, class_type); intern->flags = 0; intern->traverse_position = 0; intern->debug_info = NULL; if (orig) { spl_dllist_object *other = Z_SPLDLLIST_P(orig); intern->ce_get_iterator = other->ce_get_iterator; if (clone_orig) { intern->llist = (spl_ptr_llist *)spl_ptr_llist_init(other->llist->ctor, other->llist->dtor); spl_ptr_llist_copy(other->llist, intern->llist); intern->traverse_pointer = intern->llist->head; SPL_LLIST_CHECK_ADDREF(intern->traverse_pointer); } else { intern->llist = other->llist; intern->traverse_pointer = intern->llist->head; SPL_LLIST_CHECK_ADDREF(intern->traverse_pointer); } intern->flags = other->flags; } else { intern->llist = (spl_ptr_llist *)spl_ptr_llist_init(spl_ptr_llist_zval_ctor, spl_ptr_llist_zval_dtor); intern->traverse_pointer = intern->llist->head; SPL_LLIST_CHECK_ADDREF(intern->traverse_pointer); } 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; } parent = parent->parent; inherited = 1; } if (!parent) { /* this must never happen */ php_error_docref(NULL, E_COMPILE_ERROR, "Internal compiler error, Class is not child of SplDoublyLinkedList"); } if (inherited) { intern->fptr_offset_get = zend_hash_str_find_ptr(&class_type->function_table, "offsetget", sizeof("offsetget") - 1); if (intern->fptr_offset_get->common.scope == parent) { intern->fptr_offset_get = NULL; } intern->fptr_offset_set = zend_hash_str_find_ptr(&class_type->function_table, "offsetset", sizeof("offsetset") - 1); if (intern->fptr_offset_set->common.scope == parent) { intern->fptr_offset_set = NULL; } intern->fptr_offset_has = zend_hash_str_find_ptr(&class_type->function_table, "offsetexists", sizeof("offsetexists") - 1); if (intern->fptr_offset_has->common.scope == parent) { intern->fptr_offset_has = NULL; } intern->fptr_offset_del = zend_hash_str_find_ptr(&class_type->function_table, "offsetunset", sizeof("offsetunset") - 1); if (intern->fptr_offset_del->common.scope == parent) { intern->fptr_offset_del = NULL; } intern->fptr_count = zend_hash_str_find_ptr(&class_type->function_table, "count", sizeof("count") - 1); if (intern->fptr_count->common.scope == parent) { intern->fptr_count = NULL; } } return &intern->std; }