Lines Matching refs:intern

123 	zend_object_iterator   intern;  member
173 spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(&iter->intern.data); in spl_recursive_it_dtor()
187 zval_ptr_dtor(&iter->intern.data); in spl_recursive_it_dtor()
463 ZVAL_COPY(&iterator->intern.data, zobject); in spl_recursive_it_get_iterator()
464 iterator->intern.funcs = ce->iterator_funcs.funcs; in spl_recursive_it_get_iterator()
481 spl_recursive_it_object *intern; in spl_recursive_it_it_construct() local
546 intern = Z_SPLRECURSIVE_IT_P(object); in spl_recursive_it_it_construct()
547 intern->iterators = emalloc(sizeof(spl_sub_iterator)); in spl_recursive_it_it_construct()
548 intern->level = 0; in spl_recursive_it_it_construct()
549 intern->mode = mode; in spl_recursive_it_it_construct()
550 intern->flags = (int)flags; in spl_recursive_it_it_construct()
551 intern->max_depth = -1; in spl_recursive_it_it_construct()
552 intern->in_iteration = 0; in spl_recursive_it_it_construct()
553 intern->ce = Z_OBJCE_P(object); in spl_recursive_it_it_construct()
555intern->beginIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "beginiteration", siz… in spl_recursive_it_it_construct()
556 if (intern->beginIteration->common.scope == ce_base) { in spl_recursive_it_it_construct()
557 intern->beginIteration = NULL; in spl_recursive_it_it_construct()
559intern->endIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "enditeration", sizeof(… in spl_recursive_it_it_construct()
560 if (intern->endIteration->common.scope == ce_base) { in spl_recursive_it_it_construct()
561 intern->endIteration = NULL; in spl_recursive_it_it_construct()
563intern->callHasChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callhaschildren", s… in spl_recursive_it_it_construct()
564 if (intern->callHasChildren->common.scope == ce_base) { in spl_recursive_it_it_construct()
565 intern->callHasChildren = NULL; in spl_recursive_it_it_construct()
567intern->callGetChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callgetchildren", s… in spl_recursive_it_it_construct()
568 if (intern->callGetChildren->common.scope == ce_base) { in spl_recursive_it_it_construct()
569 intern->callGetChildren = NULL; in spl_recursive_it_it_construct()
571intern->beginChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "beginchildren", sizeo… in spl_recursive_it_it_construct()
572 if (intern->beginChildren->common.scope == ce_base) { in spl_recursive_it_it_construct()
573 intern->beginChildren = NULL; in spl_recursive_it_it_construct()
575intern->endChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "endchildren", sizeof("e… in spl_recursive_it_it_construct()
576 if (intern->endChildren->common.scope == ce_base) { in spl_recursive_it_it_construct()
577 intern->endChildren = NULL; in spl_recursive_it_it_construct()
579intern->nextElement = zend_hash_str_find_ptr(&intern->ce->function_table, "nextelement", sizeof("n… in spl_recursive_it_it_construct()
580 if (intern->nextElement->common.scope == ce_base) { in spl_recursive_it_it_construct()
581 intern->nextElement = NULL; in spl_recursive_it_it_construct()
585 intern->iterators[0].iterator = ce_iterator->get_iterator(ce_iterator, iterator, 0); in spl_recursive_it_it_construct()
586 ZVAL_COPY_VALUE(&intern->iterators[0].zobject, iterator); in spl_recursive_it_it_construct()
587 intern->iterators[0].ce = ce_iterator; in spl_recursive_it_it_construct()
588 intern->iterators[0].state = RS_START; in spl_recursive_it_it_construct()
595 while (intern->level >= 0) { in spl_recursive_it_it_construct()
596 sub_iter = intern->iterators[intern->level].iterator; in spl_recursive_it_it_construct()
598 zval_ptr_dtor(&intern->iterators[intern->level--].zobject); in spl_recursive_it_it_construct()
600 efree(intern->iterators); in spl_recursive_it_it_construct()
601 intern->iterators = NULL; in spl_recursive_it_it_construct()
962 spl_recursive_it_object *intern; in spl_RecursiveIteratorIterator_new_ex() local
964 intern = ecalloc(1, sizeof(spl_recursive_it_object) + zend_object_properties_size(class_type)); in spl_RecursiveIteratorIterator_new_ex()
967 smart_str_appendl(&intern->prefix[0], "", 0); in spl_RecursiveIteratorIterator_new_ex()
968 smart_str_appendl(&intern->prefix[1], "| ", 2); in spl_RecursiveIteratorIterator_new_ex()
969 smart_str_appendl(&intern->prefix[2], " ", 2); in spl_RecursiveIteratorIterator_new_ex()
970 smart_str_appendl(&intern->prefix[3], "|-", 2); in spl_RecursiveIteratorIterator_new_ex()
971 smart_str_appendl(&intern->prefix[4], "\\-", 2); in spl_RecursiveIteratorIterator_new_ex()
972 smart_str_appendl(&intern->prefix[5], "", 0); in spl_RecursiveIteratorIterator_new_ex()
974 smart_str_appendl(&intern->postfix[0], "", 0); in spl_RecursiveIteratorIterator_new_ex()
977 zend_object_std_init(&intern->std, class_type); in spl_RecursiveIteratorIterator_new_ex()
978 object_properties_init(&intern->std, class_type); in spl_RecursiveIteratorIterator_new_ex()
980 intern->std.handlers = &spl_handlers_rec_it_it; in spl_RecursiveIteratorIterator_new_ex()
981 return &intern->std; in spl_RecursiveIteratorIterator_new_ex()
1371 spl_dual_it_object *intern; in spl_dual_it_get_method() local
1373 intern = spl_dual_it_from_obj(*object); in spl_dual_it_get_method()
1376 if (!function_handler && intern->inner.ce) { in spl_dual_it_get_method()
1377 if ((function_handler = zend_hash_find_ptr(&intern->inner.ce->function_table, method)) == NULL) { in spl_dual_it_get_method()
1378 if (Z_OBJ_HT(intern->inner.zobject)->get_method) { in spl_dual_it_get_method()
1379 *object = Z_OBJ(intern->inner.zobject); in spl_dual_it_get_method()
1383 *object = Z_OBJ(intern->inner.zobject); in spl_dual_it_get_method()
1398 spl_dual_it_object *intern; in spl_dual_it_call_method() local
1400 intern = Z_SPLDUAL_IT_P(getThis()); in spl_dual_it_call_method()
1421 zend_throw_error(NULL, "Unable to call %s::%s()", intern->inner.ce->name, method); in spl_dual_it_call_method()
1430 #define SPL_CHECK_CTOR(intern, classname) \ argument
1431 if (intern->dit_type == DIT_Unknown) { \
1437 #define APPENDIT_CHECK_CTOR(intern) SPL_CHECK_CTOR(intern, AppendIterator) argument
1439 static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more);
1456 spl_dual_it_object *intern; in spl_dual_it_construct() local
1461 intern = Z_SPLDUAL_IT_P(getThis()); in spl_dual_it_construct()
1463 if (intern->dit_type != DIT_Unknown) { in spl_dual_it_construct()
1468 intern->dit_type = dit_type; in spl_dual_it_construct()
1471 intern->u.limit.offset = 0; /* start at beginning */ in spl_dual_it_construct()
1472 intern->u.limit.count = -1; /* get all */ in spl_dual_it_construct()
1473 …rameters_throw(ZEND_NUM_ARGS(), "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.li… in spl_dual_it_construct()
1476 if (intern->u.limit.offset < 0) { in spl_dual_it_construct()
1480 if (intern->u.limit.count < 0 && intern->u.limit.count != -1) { in spl_dual_it_construct()
1496 intern->u.caching.flags |= flags & CIT_PUBLIC; in spl_dual_it_construct()
1497 array_init(&intern->u.caching.zcache); in spl_dual_it_construct()
1538 spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit); in spl_dual_it_construct()
1539 …zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIter… in spl_dual_it_construct()
1540intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.ap… in spl_dual_it_construct()
1542 return intern; in spl_dual_it_construct()
1549 intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5; in spl_dual_it_construct()
1550 intern->u.regex.flags = 0; in spl_dual_it_construct()
1551 intern->u.regex.preg_flags = 0; in spl_dual_it_construct()
1552 …ND_NUM_ARGS(), "OS|lll", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.reg… in spl_dual_it_construct()
1559 intern->u.regex.mode = mode; in spl_dual_it_construct()
1560 intern->u.regex.regex = zend_string_copy(regex); in spl_dual_it_construct()
1563 intern->u.regex.pce = pcre_get_compiled_regex_cache(regex); in spl_dual_it_construct()
1566 if (intern->u.regex.pce == NULL) { in spl_dual_it_construct()
1570 intern->u.regex.pce->refcount++; in spl_dual_it_construct()
1587 intern->u.cbfilter = cfi; in spl_dual_it_construct()
1598 ZVAL_COPY(&intern->inner.zobject, zobject); in spl_dual_it_construct()
1600 ZVAL_COPY_VALUE(&intern->inner.zobject, zobject); in spl_dual_it_construct()
1603 intern->inner.ce = dit_type == DIT_IteratorIterator ? ce : Z_OBJCE_P(zobject); in spl_dual_it_construct()
1604 intern->inner.object = Z_OBJ_P(zobject); in spl_dual_it_construct()
1605 intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, zobject, 0); in spl_dual_it_construct()
1607 return intern; in spl_dual_it_construct()
1631 spl_dual_it_object *intern; in SPL_METHOD() local
1637 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1639 if (!Z_ISUNDEF(intern->inner.zobject)) { in SPL_METHOD()
1640 zval *value = &intern->inner.zobject; in SPL_METHOD()
1649 static inline void spl_dual_it_free(spl_dual_it_object *intern) in spl_dual_it_free() argument
1651 if (intern->inner.iterator && intern->inner.iterator->funcs->invalidate_current) { in spl_dual_it_free()
1652 intern->inner.iterator->funcs->invalidate_current(intern->inner.iterator); in spl_dual_it_free()
1654 if (Z_TYPE(intern->current.data) != IS_UNDEF) { in spl_dual_it_free()
1655 zval_ptr_dtor(&intern->current.data); in spl_dual_it_free()
1656 ZVAL_UNDEF(&intern->current.data); in spl_dual_it_free()
1658 if (Z_TYPE(intern->current.key) != IS_UNDEF) { in spl_dual_it_free()
1659 zval_ptr_dtor(&intern->current.key); in spl_dual_it_free()
1660 ZVAL_UNDEF(&intern->current.key); in spl_dual_it_free()
1662 if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_RecursiveCachingIterator) { in spl_dual_it_free()
1663 if (Z_TYPE(intern->u.caching.zstr) != IS_UNDEF) { in spl_dual_it_free()
1664 zval_ptr_dtor(&intern->u.caching.zstr); in spl_dual_it_free()
1665 ZVAL_UNDEF(&intern->u.caching.zstr); in spl_dual_it_free()
1667 if (Z_TYPE(intern->u.caching.zchildren) != IS_UNDEF) { in spl_dual_it_free()
1668 zval_ptr_dtor(&intern->u.caching.zchildren); in spl_dual_it_free()
1669 ZVAL_UNDEF(&intern->u.caching.zchildren); in spl_dual_it_free()
1674 static inline void spl_dual_it_rewind(spl_dual_it_object *intern) in spl_dual_it_rewind() argument
1676 spl_dual_it_free(intern); in spl_dual_it_rewind()
1677 intern->current.pos = 0; in spl_dual_it_rewind()
1678 if (intern->inner.iterator && intern->inner.iterator->funcs->rewind) { in spl_dual_it_rewind()
1679 intern->inner.iterator->funcs->rewind(intern->inner.iterator); in spl_dual_it_rewind()
1683 static inline int spl_dual_it_valid(spl_dual_it_object *intern) in spl_dual_it_valid() argument
1685 if (!intern->inner.iterator) { in spl_dual_it_valid()
1689 return intern->inner.iterator->funcs->valid(intern->inner.iterator); in spl_dual_it_valid()
1692 static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more) in spl_dual_it_fetch() argument
1696 spl_dual_it_free(intern); in spl_dual_it_fetch()
1697 if (!check_more || spl_dual_it_valid(intern) == SUCCESS) { in spl_dual_it_fetch()
1698 data = intern->inner.iterator->funcs->get_current_data(intern->inner.iterator); in spl_dual_it_fetch()
1700 ZVAL_COPY(&intern->current.data, data); in spl_dual_it_fetch()
1703 if (intern->inner.iterator->funcs->get_current_key) { in spl_dual_it_fetch()
1704 intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.key); in spl_dual_it_fetch()
1706 zval_ptr_dtor(&intern->current.key); in spl_dual_it_fetch()
1707 ZVAL_UNDEF(&intern->current.key); in spl_dual_it_fetch()
1710 ZVAL_LONG(&intern->current.key, intern->current.pos); in spl_dual_it_fetch()
1717 static inline void spl_dual_it_next(spl_dual_it_object *intern, int do_free) in spl_dual_it_next() argument
1720 spl_dual_it_free(intern); in spl_dual_it_next()
1721 } else if (!intern->inner.iterator) { in spl_dual_it_next()
1725 intern->inner.iterator->funcs->move_forward(intern->inner.iterator); in spl_dual_it_next()
1726 intern->current.pos++; in spl_dual_it_next()
1735 spl_dual_it_object *intern; in SPL_METHOD() local
1741 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1743 spl_dual_it_rewind(intern); in SPL_METHOD()
1744 spl_dual_it_fetch(intern, 1); in SPL_METHOD()
1754 spl_dual_it_object *intern; in SPL_METHOD() local
1760 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1762 RETURN_BOOL(Z_TYPE(intern->current.data) != IS_UNDEF); in SPL_METHOD()
1775 spl_dual_it_object *intern; in SPL_METHOD() local
1781 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1783 if (Z_TYPE(intern->current.key) != IS_UNDEF) { in SPL_METHOD()
1784 zval *value = &intern->current.key; in SPL_METHOD()
1802 spl_dual_it_object *intern; in SPL_METHOD() local
1808 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1810 if (Z_TYPE(intern->current.data) != IS_UNDEF) { in SPL_METHOD()
1811 zval *value = &intern->current.data; in SPL_METHOD()
1826 spl_dual_it_object *intern; in SPL_METHOD() local
1832 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1834 spl_dual_it_next(intern, 1); in SPL_METHOD()
1835 spl_dual_it_fetch(intern, 1); in SPL_METHOD()
1838 static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern) in spl_filter_it_fetch() argument
1842 while (spl_dual_it_fetch(intern, 1) == SUCCESS) { in spl_filter_it_fetch()
1843 zend_call_method_with_0_params(zthis, intern->std.ce, NULL, "accept", &retval); in spl_filter_it_fetch()
1854 intern->inner.iterator->funcs->move_forward(intern->inner.iterator); in spl_filter_it_fetch()
1856 spl_dual_it_free(intern); in spl_filter_it_fetch()
1859 static inline void spl_filter_it_rewind(zval *zthis, spl_dual_it_object *intern) in spl_filter_it_rewind() argument
1861 spl_dual_it_rewind(intern); in spl_filter_it_rewind()
1862 spl_filter_it_fetch(zthis, intern); in spl_filter_it_rewind()
1865 static inline void spl_filter_it_next(zval *zthis, spl_dual_it_object *intern) in spl_filter_it_next() argument
1867 spl_dual_it_next(intern, 1); in spl_filter_it_next()
1868 spl_filter_it_fetch(zthis, intern); in spl_filter_it_next()
1875 spl_dual_it_object *intern; in SPL_METHOD() local
1881 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1882 spl_filter_it_rewind(getThis(), intern); in SPL_METHOD()
1889 spl_dual_it_object *intern; in SPL_METHOD() local
1895 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1896 spl_filter_it_next(getThis(), intern); in SPL_METHOD()
1918 spl_dual_it_object *intern; in SPL_METHOD() local
1925 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1927 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &ret… in SPL_METHOD()
1939 spl_dual_it_object *intern; in SPL_METHOD() local
1946 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1948 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &ret… in SPL_METHOD()
1959 spl_dual_it_object *intern; in SPL_METHOD() local
1966 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
1968 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &ret… in SPL_METHOD()
1970 …spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &retval, &intern->u.cbfilter->fci.func… in SPL_METHOD()
1993 spl_dual_it_object *intern = Z_SPLDUAL_IT_P(getThis()); in SPL_METHOD() local
1994 zend_fcall_info *fci = &intern->u.cbfilter->fci; in SPL_METHOD()
1995 zend_fcall_info_cache *fcc = &intern->u.cbfilter->fcc; in SPL_METHOD()
2002 if (Z_TYPE(intern->current.data) == IS_UNDEF || Z_TYPE(intern->current.key) == IS_UNDEF) { in SPL_METHOD()
2006 ZVAL_COPY_VALUE(&params[0], &intern->current.data); in SPL_METHOD()
2007 ZVAL_COPY_VALUE(&params[1], &intern->current.key); in SPL_METHOD()
2008 ZVAL_COPY_VALUE(&params[2], &intern->inner.zobject); in SPL_METHOD()
2024 ZVAL_COPY_VALUE(&intern->current.data, &params[0]); in SPL_METHOD()
2025 ZVAL_COPY_VALUE(&intern->current.key, &params[1]); in SPL_METHOD()
2033 spl_dual_it_object *intern; in SPL_METHOD() local
2042 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2044 if (Z_TYPE(intern->current.data) == IS_UNDEF) { in SPL_METHOD()
2048 if (intern->u.regex.flags & REGIT_USE_KEY) { in SPL_METHOD()
2049 subject = zval_get_string(&intern->current.key); in SPL_METHOD()
2051 if (Z_TYPE(intern->current.data) == IS_ARRAY) { in SPL_METHOD()
2054 subject = zval_get_string(&intern->current.data); in SPL_METHOD()
2057 switch (intern->u.regex.mode) in SPL_METHOD()
2062 if (intern->u.regex.pce->extra) { in SPL_METHOD()
2063 intern->u.regex.pce->extra->flags &= ~PCRE_EXTRA_MARK; in SPL_METHOD()
2066 …count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, ZSTR_VAL(subject), ZSTR_LEN… in SPL_METHOD()
2072 zval_ptr_dtor(&intern->current.data); in SPL_METHOD()
2073 ZVAL_UNDEF(&intern->current.data); in SPL_METHOD()
2074 php_pcre_match_impl(intern->u.regex.pce, ZSTR_VAL(subject), ZSTR_LEN(subject), &zcount, in SPL_METHOD()
2075 …&intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, in SPL_METHOD()
2080 zval_ptr_dtor(&intern->current.data); in SPL_METHOD()
2081 ZVAL_UNDEF(&intern->current.data); in SPL_METHOD()
2082 …php_pcre_split_impl(intern->u.regex.pce, subject, &intern->current.data, -1, intern->u.regex.preg_… in SPL_METHOD()
2083 count = zend_hash_num_elements(Z_ARRVAL(intern->current.data)); in SPL_METHOD()
2088 …replacement = zend_read_property(intern->std.ce, getThis(), "replacement", sizeof("replacement")-1… in SPL_METHOD()
2094 …result = php_pcre_replace_impl(intern->u.regex.pce, subject, ZSTR_VAL(subject), ZSTR_LEN(subject),… in SPL_METHOD()
2096 if (intern->u.regex.flags & REGIT_USE_KEY) { in SPL_METHOD()
2097 zval_ptr_dtor(&intern->current.key); in SPL_METHOD()
2098 ZVAL_STR(&intern->current.key, result); in SPL_METHOD()
2100 zval_ptr_dtor(&intern->current.data); in SPL_METHOD()
2101 ZVAL_STR(&intern->current.data, result); in SPL_METHOD()
2110 if (intern->u.regex.flags & REGIT_INVERTED) { in SPL_METHOD()
2120 spl_dual_it_object *intern = Z_SPLDUAL_IT_P(getThis()); in SPL_METHOD() local
2126 RETURN_STR_COPY(intern->u.regex.regex); in SPL_METHOD()
2133 spl_dual_it_object *intern; in SPL_METHOD() local
2139 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2141 RETURN_LONG(intern->u.regex.mode); in SPL_METHOD()
2148 spl_dual_it_object *intern; in SPL_METHOD() local
2160 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2162 intern->u.regex.mode = mode; in SPL_METHOD()
2169 spl_dual_it_object *intern; in SPL_METHOD() local
2175 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2177 RETURN_LONG(intern->u.regex.flags); in SPL_METHOD()
2184 spl_dual_it_object *intern; in SPL_METHOD() local
2191 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2193 intern->u.regex.flags = flags; in SPL_METHOD()
2200 spl_dual_it_object *intern; in SPL_METHOD() local
2206 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2208 if (intern->u.regex.use_flags) { in SPL_METHOD()
2209 RETURN_LONG(intern->u.regex.preg_flags); in SPL_METHOD()
2219 spl_dual_it_object *intern; in SPL_METHOD() local
2226 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2228 intern->u.regex.preg_flags = preg_flags; in SPL_METHOD()
2229 intern->u.regex.use_flags = 1; in SPL_METHOD()
2243 spl_dual_it_object *intern; in SPL_METHOD() local
2250 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2252 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &ret… in SPL_METHOD()
2257 ZVAL_STR_COPY(&args[1], intern->u.regex.regex); in SPL_METHOD()
2258 ZVAL_LONG(&args[2], intern->u.regex.mode); in SPL_METHOD()
2259 ZVAL_LONG(&args[3], intern->u.regex.flags); in SPL_METHOD()
2260 ZVAL_LONG(&args[4], intern->u.regex.preg_flags); in SPL_METHOD()
2272 spl_dual_it_object *intern; in SPL_METHOD() local
2278 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2280 if (Z_TYPE(intern->current.data) == IS_UNDEF) { in SPL_METHOD()
2282 } else if (Z_TYPE(intern->current.data) == IS_ARRAY) { in SPL_METHOD()
2283 RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0); in SPL_METHOD()
2358 spl_dual_it_object *intern; in spl_dual_it_new() local
2360 intern = ecalloc(1, sizeof(spl_dual_it_object) + zend_object_properties_size(class_type)); in spl_dual_it_new()
2361 intern->dit_type = DIT_Unknown; in spl_dual_it_new()
2363 zend_object_std_init(&intern->std, class_type); in spl_dual_it_new()
2364 object_properties_init(&intern->std, class_type); in spl_dual_it_new()
2366 intern->std.handlers = &spl_handlers_dual_it; in spl_dual_it_new()
2367 return &intern->std; in spl_dual_it_new()
2478 static inline int spl_limit_it_valid(spl_dual_it_object *intern) in spl_limit_it_valid() argument
2481 …if (intern->u.limit.count != -1 && intern->current.pos >= intern->u.limit.offset + intern->u.limit… in spl_limit_it_valid()
2484 return spl_dual_it_valid(intern); in spl_limit_it_valid()
2488 static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos) in spl_limit_it_seek() argument
2492 spl_dual_it_free(intern); in spl_limit_it_seek()
2493 if (pos < intern->u.limit.offset) { in spl_limit_it_seek()
2494 … seek to " ZEND_LONG_FMT " which is below the offset " ZEND_LONG_FMT, pos, intern->u.limit.offset); in spl_limit_it_seek()
2497 if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) { in spl_limit_it_seek()
2498 …nd offset " ZEND_LONG_FMT " plus count " ZEND_LONG_FMT, pos, intern->u.limit.offset, intern->u.lim… in spl_limit_it_seek()
2501 if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) { in spl_limit_it_seek()
2503 spl_dual_it_free(intern); in spl_limit_it_seek()
2504 …zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos… in spl_limit_it_seek()
2507 intern->current.pos = pos; in spl_limit_it_seek()
2508 if (spl_limit_it_valid(intern) == SUCCESS) { in spl_limit_it_seek()
2509 spl_dual_it_fetch(intern, 0); in spl_limit_it_seek()
2515 if (pos < intern->current.pos) { in spl_limit_it_seek()
2516 spl_dual_it_rewind(intern); in spl_limit_it_seek()
2518 while (pos > intern->current.pos && spl_dual_it_valid(intern) == SUCCESS) { in spl_limit_it_seek()
2519 spl_dual_it_next(intern, 1); in spl_limit_it_seek()
2521 if (spl_dual_it_valid(intern) == SUCCESS) { in spl_limit_it_seek()
2522 spl_dual_it_fetch(intern, 1); in spl_limit_it_seek()
2538 spl_dual_it_object *intern; in SPL_METHOD() local
2540 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2541 spl_dual_it_rewind(intern); in SPL_METHOD()
2542 spl_limit_it_seek(intern, intern->u.limit.offset); in SPL_METHOD()
2549 spl_dual_it_object *intern; in SPL_METHOD() local
2551 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2554 …RETURN_BOOL((intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern-… in SPL_METHOD()
2561 spl_dual_it_object *intern; in SPL_METHOD() local
2563 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2565 spl_dual_it_next(intern, 1); in SPL_METHOD()
2566 …if (intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern->u.limit.… in SPL_METHOD()
2567 spl_dual_it_fetch(intern, 1); in SPL_METHOD()
2575 spl_dual_it_object *intern; in SPL_METHOD() local
2582 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2583 spl_limit_it_seek(intern, pos); in SPL_METHOD()
2584 RETURN_LONG(intern->current.pos); in SPL_METHOD()
2591 spl_dual_it_object *intern; in SPL_METHOD() local
2592 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2593 RETURN_LONG(intern->current.pos); in SPL_METHOD()
2628 static inline int spl_caching_it_valid(spl_dual_it_object *intern) in spl_caching_it_valid() argument
2630 return intern->u.caching.flags & CIT_VALID ? SUCCESS : FAILURE; in spl_caching_it_valid()
2633 static inline int spl_caching_it_has_next(spl_dual_it_object *intern) in spl_caching_it_has_next() argument
2635 return spl_dual_it_valid(intern); in spl_caching_it_has_next()
2638 static inline void spl_caching_it_next(spl_dual_it_object *intern) in spl_caching_it_next() argument
2640 if (spl_dual_it_fetch(intern, 1) == SUCCESS) { in spl_caching_it_next()
2641 intern->u.caching.flags |= CIT_VALID; in spl_caching_it_next()
2643 if (intern->u.caching.flags & CIT_FULL_CACHE) { in spl_caching_it_next()
2644 zval *key = &intern->current.key; in spl_caching_it_next()
2645 zval *data = &intern->current.data; in spl_caching_it_next()
2649 array_set_zval_key(Z_ARRVAL(intern->u.caching.zcache), key, data); in spl_caching_it_next()
2653 if (intern->dit_type == DIT_RecursiveCachingIterator) { in spl_caching_it_next()
2655 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &ret… in spl_caching_it_next()
2658 if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { in spl_caching_it_next()
2665 …zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zch… in spl_caching_it_next()
2668 if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { in spl_caching_it_next()
2675 ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); in spl_caching_it_next()
2676 …spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, &zchildren,… in spl_caching_it_next()
2682 if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { in spl_caching_it_next()
2690 if (intern->u.caching.flags & (CIT_TOSTRING_USE_INNER|CIT_CALL_TOSTRING)) { in spl_caching_it_next()
2693 if (intern->u.caching.flags & CIT_TOSTRING_USE_INNER) { in spl_caching_it_next()
2694 ZVAL_COPY_VALUE(&intern->u.caching.zstr, &intern->inner.zobject); in spl_caching_it_next()
2696 ZVAL_COPY_VALUE(&intern->u.caching.zstr, &intern->current.data); in spl_caching_it_next()
2698 use_copy = zend_make_printable_zval(&intern->u.caching.zstr, &expr_copy); in spl_caching_it_next()
2700 ZVAL_COPY_VALUE(&intern->u.caching.zstr, &expr_copy); in spl_caching_it_next()
2701 } else if (Z_REFCOUNTED(intern->u.caching.zstr)) { in spl_caching_it_next()
2702 Z_ADDREF(intern->u.caching.zstr); in spl_caching_it_next()
2705 spl_dual_it_next(intern, 0); in spl_caching_it_next()
2707 intern->u.caching.flags &= ~CIT_VALID; in spl_caching_it_next()
2711 static inline void spl_caching_it_rewind(spl_dual_it_object *intern) in spl_caching_it_rewind() argument
2713 spl_dual_it_rewind(intern); in spl_caching_it_rewind()
2714 zend_hash_clean(Z_ARRVAL(intern->u.caching.zcache)); in spl_caching_it_rewind()
2715 spl_caching_it_next(intern); in spl_caching_it_rewind()
2729 spl_dual_it_object *intern; in SPL_METHOD() local
2735 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2737 spl_caching_it_rewind(intern); in SPL_METHOD()
2744 spl_dual_it_object *intern; in SPL_METHOD() local
2750 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2752 RETURN_BOOL(spl_caching_it_valid(intern) == SUCCESS); in SPL_METHOD()
2759 spl_dual_it_object *intern; in SPL_METHOD() local
2765 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2767 spl_caching_it_next(intern); in SPL_METHOD()
2774 spl_dual_it_object *intern; in SPL_METHOD() local
2780 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2782 RETURN_BOOL(spl_caching_it_has_next(intern) == SUCCESS); in SPL_METHOD()
2789 spl_dual_it_object *intern; in SPL_METHOD() local
2791 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2793 …if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|C… in SPL_METHOD()
2797 if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) { in SPL_METHOD()
2798 ZVAL_COPY(return_value, &intern->current.key); in SPL_METHOD()
2801 } else if (intern->u.caching.flags & CIT_TOSTRING_USE_CURRENT) { in SPL_METHOD()
2802 ZVAL_COPY(return_value, &intern->current.data); in SPL_METHOD()
2806 if (Z_TYPE(intern->u.caching.zstr) == IS_STRING) { in SPL_METHOD()
2807 RETURN_STR_COPY(Z_STR_P(&intern->u.caching.zstr)); in SPL_METHOD()
2817 spl_dual_it_object *intern; in SPL_METHOD() local
2821 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2823 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2835 zend_symtable_update(Z_ARRVAL(intern->u.caching.zcache), key, value); in SPL_METHOD()
2843 spl_dual_it_object *intern; in SPL_METHOD() local
2847 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2849 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2858 if ((value = zend_symtable_find(Z_ARRVAL(intern->u.caching.zcache), key)) == NULL) { in SPL_METHOD()
2872 spl_dual_it_object *intern; in SPL_METHOD() local
2875 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2877 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2886 zend_symtable_del(Z_ARRVAL(intern->u.caching.zcache), key); in SPL_METHOD()
2894 spl_dual_it_object *intern; in SPL_METHOD() local
2897 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2899 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2908 RETURN_BOOL(zend_symtable_exists(Z_ARRVAL(intern->u.caching.zcache), key)); in SPL_METHOD()
2916 spl_dual_it_object *intern; in SPL_METHOD() local
2922 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2924 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2929 ZVAL_COPY(return_value, &intern->u.caching.zcache); in SPL_METHOD()
2937 spl_dual_it_object *intern; in SPL_METHOD() local
2943 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2945 RETURN_LONG(intern->u.caching.flags); in SPL_METHOD()
2953 spl_dual_it_object *intern; in SPL_METHOD() local
2956 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2966 if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & CIT_CALL_TOSTRING) == 0) { in SPL_METHOD()
2970 …if ((intern->u.caching.flags & CIT_TOSTRING_USE_INNER) != 0 && (flags & CIT_TOSTRING_USE_INNER) ==… in SPL_METHOD()
2974 if ((flags & CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) { in SPL_METHOD()
2976 zend_hash_clean(Z_ARRVAL(intern->u.caching.zcache)); in SPL_METHOD()
2978 intern->u.caching.flags = (intern->u.caching.flags & ~CIT_PUBLIC) | (flags & CIT_PUBLIC); in SPL_METHOD()
2986 spl_dual_it_object *intern; in SPL_METHOD() local
2992 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
2994 if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { in SPL_METHOD()
2999 RETURN_LONG(zend_hash_num_elements(Z_ARRVAL(intern->u.caching.zcache))); in SPL_METHOD()
3053 spl_dual_it_object *intern; in SPL_METHOD() local
3059 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3061 RETURN_BOOL(Z_TYPE(intern->u.caching.zchildren) != IS_UNDEF); in SPL_METHOD()
3068 spl_dual_it_object *intern; in SPL_METHOD() local
3074 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3076 if (Z_TYPE(intern->u.caching.zchildren) != IS_UNDEF) { in SPL_METHOD()
3077 zval *value = &intern->u.caching.zchildren; in SPL_METHOD()
3141 spl_dual_it_object *intern; in SPL_METHOD() local
3147 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3148 RETURN_BOOL(intern->inner.iterator->funcs->valid(intern->inner.iterator) == SUCCESS); in SPL_METHOD()
3155 spl_dual_it_object *intern; in SPL_METHOD() local
3161 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3163 if (intern->inner.iterator->funcs->get_current_key) { in SPL_METHOD()
3164 intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, return_value); in SPL_METHOD()
3174 spl_dual_it_object *intern; in SPL_METHOD() local
3181 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3182 data = intern->inner.iterator->funcs->get_current_data(intern->inner.iterator); in SPL_METHOD()
3193 spl_dual_it_object *intern; in SPL_METHOD() local
3199 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3200 intern->inner.iterator->funcs->move_forward(intern->inner.iterator); in SPL_METHOD()
3229 spl_dual_it_object *intern; in SPL_METHOD() local
3235 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3237 spl_dual_it_next(intern, 1); in SPL_METHOD()
3238 if (spl_dual_it_valid(intern) == SUCCESS) { in SPL_METHOD()
3239 spl_dual_it_fetch(intern, 0); in SPL_METHOD()
3241 spl_dual_it_rewind(intern); in SPL_METHOD()
3242 if (spl_dual_it_valid(intern) == SUCCESS) { in SPL_METHOD()
3243 spl_dual_it_fetch(intern, 0); in SPL_METHOD()
3311 int spl_append_it_next_iterator(spl_dual_it_object *intern) /* {{{*/ in spl_append_it_next_iterator() argument
3313 spl_dual_it_free(intern); in spl_append_it_next_iterator()
3315 if (!Z_ISUNDEF(intern->inner.zobject)) { in spl_append_it_next_iterator()
3316 zval_ptr_dtor(&intern->inner.zobject); in spl_append_it_next_iterator()
3317 ZVAL_UNDEF(&intern->inner.zobject); in spl_append_it_next_iterator()
3318 intern->inner.ce = NULL; in spl_append_it_next_iterator()
3319 if (intern->inner.iterator) { in spl_append_it_next_iterator()
3320 zend_iterator_dtor(intern->inner.iterator); in spl_append_it_next_iterator()
3321 intern->inner.iterator = NULL; in spl_append_it_next_iterator()
3324 if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator) == SUCCESS) { in spl_append_it_next_iterator()
3327 it = intern->u.append.iterator->funcs->get_current_data(intern->u.append.iterator); in spl_append_it_next_iterator()
3328 ZVAL_COPY(&intern->inner.zobject, it); in spl_append_it_next_iterator()
3329 intern->inner.ce = Z_OBJCE_P(it); in spl_append_it_next_iterator()
3330 intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, it, 0); in spl_append_it_next_iterator()
3331 spl_dual_it_rewind(intern); in spl_append_it_next_iterator()
3338 void spl_append_it_fetch(spl_dual_it_object *intern) /* {{{*/ in spl_append_it_fetch() argument
3340 while (spl_dual_it_valid(intern) != SUCCESS) { in spl_append_it_fetch()
3341 intern->u.append.iterator->funcs->move_forward(intern->u.append.iterator); in spl_append_it_fetch()
3342 if (spl_append_it_next_iterator(intern) != SUCCESS) { in spl_append_it_fetch()
3346 spl_dual_it_fetch(intern, 0); in spl_append_it_fetch()
3349 void spl_append_it_next(spl_dual_it_object *intern) /* {{{ */ in spl_append_it_next() argument
3351 if (spl_dual_it_valid(intern) == SUCCESS) { in spl_append_it_next()
3352 spl_dual_it_next(intern, 1); in spl_append_it_next()
3354 spl_append_it_fetch(intern); in spl_append_it_next()
3368 spl_dual_it_object *intern; in SPL_METHOD() local
3371 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3376 …if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator) == SUCCESS && spl_dual_it_v… in SPL_METHOD()
3377 spl_array_iterator_append(&intern->u.append.zarrayit, it); in SPL_METHOD()
3378 intern->u.append.iterator->funcs->move_forward(intern->u.append.iterator); in SPL_METHOD()
3380 spl_array_iterator_append(&intern->u.append.zarrayit, it); in SPL_METHOD()
3383 if (!intern->inner.iterator || spl_dual_it_valid(intern) != SUCCESS) { in SPL_METHOD()
3384 if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator) != SUCCESS) { in SPL_METHOD()
3385 intern->u.append.iterator->funcs->rewind(intern->u.append.iterator); in SPL_METHOD()
3388 spl_append_it_next_iterator(intern); in SPL_METHOD()
3389 } while (Z_OBJ(intern->inner.zobject) != Z_OBJ_P(it)); in SPL_METHOD()
3390 spl_append_it_fetch(intern); in SPL_METHOD()
3398 spl_dual_it_object *intern; in SPL_METHOD() local
3404 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3406 spl_dual_it_fetch(intern, 1); in SPL_METHOD()
3407 if (Z_TYPE(intern->current.data) != IS_UNDEF) { in SPL_METHOD()
3408 zval *value = &intern->current.data; in SPL_METHOD()
3421 spl_dual_it_object *intern; in SPL_METHOD() local
3427 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3429 intern->u.append.iterator->funcs->rewind(intern->u.append.iterator); in SPL_METHOD()
3430 if (spl_append_it_next_iterator(intern) == SUCCESS) { in SPL_METHOD()
3431 spl_append_it_fetch(intern); in SPL_METHOD()
3439 spl_dual_it_object *intern; in SPL_METHOD() local
3445 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3447 RETURN_BOOL(Z_TYPE(intern->current.data) != IS_UNDEF); in SPL_METHOD()
3454 spl_dual_it_object *intern; in SPL_METHOD() local
3460 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3462 spl_append_it_next(intern); in SPL_METHOD()
3469 spl_dual_it_object *intern; in SPL_METHOD() local
3475 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3477 APPENDIT_CHECK_CTOR(intern); in SPL_METHOD()
3478 spl_array_iterator_key(&intern->u.append.zarrayit, return_value); in SPL_METHOD()
3485 spl_dual_it_object *intern; in SPL_METHOD() local
3492 SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); in SPL_METHOD()
3494 value = &intern->u.append.zarrayit; in SPL_METHOD()