63#define Z_SPLARRAY_P(zv) spl_array_from_obj(Z_OBJ_P((zv)))
69 zend_std_get_properties_ex(&intern->
std);
73 return spl_array_get_hash_table_ptr(other);
80 if (
UNEXPECTED(zend_lazy_object_must_init(obj))) {
92 zend_std_get_properties_ex(obj);
105 return *spl_array_get_hash_table_ptr(intern);
124 spl_array_skip_protected(intern,
ht);
131 spl_array_create_ht_iter(
ht, intern);
133 return &
EG(ht_iterators)[intern->
ht_iter].pos;
138static void spl_array_object_free_storage(
zend_object *
object)
142 if (intern->
ht_iter != (uint32_t) -1) {
175 intern->
ar_flags &= ~ SPL_ARRAY_CLONE_MASK;
208 parent = parent->parent;
238 intern->
ht_iter = (uint32_t)-1;
246 return spl_array_object_new_ex(class_type,
NULL, 0);
255 new_object = spl_array_object_new_ex(old_object->
ce, old_object, 1);
270 if (
key->release_key) {
279 key->release_key =
false;
320 if (spl_array_is_object(intern)) {
322 key->release_key =
true;
335 return &
EG(uninitialized_zval);
340 return &
EG(error_zval);
346 &
EG(error_zval) : &
EG(uninitialized_zval);
391 spl_hash_key_release(&
key);
423 if (check_inherited &&
426 if (!spl_array_has_dimension(
object,
offset, 0)) {
427 return &
EG(uninitialized_zval);
442 return &
EG(uninitialized_zval);
446 ret = spl_array_get_dimension_ptr(check_inherited, intern,
object->ce->name,
offset,
type);
464 return spl_array_read_dimension_ex(1,
object,
offset,
type,
rv);
472static uint32_t spl_array_set_refcount(
bool is_child,
HashTable *
ht, uint32_t refcount)
474 uint32_t old_refcount = 0;
507 uint32_t refcount = 0;
509 ht = spl_array_get_hash_table(intern);
513 refcount = spl_array_set_refcount(intern->
is_child,
ht, 1);
517 spl_array_set_refcount(intern->
is_child,
ht, refcount);
528 ht = spl_array_get_hash_table(intern);
530 spl_hash_key_release(&
key);
533 refcount = spl_array_set_refcount(intern->
is_child,
ht, 1);
536 spl_hash_key_release(&
key);
542 spl_array_set_refcount(intern->
is_child,
ht, refcount);
548 spl_array_write_dimension_ex(1,
object,
offset,
value);
572 ht = spl_array_get_hash_table(intern);
573 uint32_t refcount = spl_array_set_refcount(intern->
is_child,
ht, 1);
586 if (spl_array_is_object(intern)) {
587 spl_array_skip_protected(intern,
ht);
595 spl_hash_key_release(&
key);
601 spl_array_set_refcount(intern->
is_child,
ht, refcount);
607 spl_array_unset_dimension_ex(1,
object,
offset);
613static bool spl_array_has_dimension_ex(
bool check_inherited,
zend_object *
object,
zval *
offset,
int check_empty)
646 spl_hash_key_release(&
key);
657 if (check_empty == 2) {
680 return spl_array_has_dimension_ex(
true,
object,
offset, check_empty);
720 if (spl_array_is_object(intern)) {
725 spl_array_write_dimension(
Z_OBJ_P(
object),
NULL, append_value);
789 ht = spl_array_get_hash_table(intern);
801 HashTable *properties = zend_std_get_properties_ex(&intern->
std);
808 debug_info =
zend_new_array(zend_hash_num_elements(properties) + 1);
827 *gc_data = &intern->
array;
841 return spl_array_read_dimension(
object, &member,
type,
rv);
854 spl_array_write_dimension(
object, &member,
value);
867 cache_slot[0] = cache_slot[1] = cache_slot[2] =
NULL;
877 return spl_array_get_dimension_ptr(1, intern,
object->ce->name, &member,
type);
890 return spl_array_has_dimension(
object, &member, has_set_exists);
903 spl_array_unset_dimension(
object, &member);
909static int spl_array_compare_objects(
zval *o1,
zval *o2)
921 ht1 = spl_array_get_hash_table(intern1);
922 ht2 = spl_array_get_hash_table(intern2);
939 if (spl_array_is_object(intern)) {
940 uint32_t *pos_ptr = spl_array_get_pos_ptr(aht, intern);
954 if (zend_hash_has_more_elements_ex(aht, pos_ptr) !=
SUCCESS) {
987 if (
Z_OBJ_HT_P(array) == &spl_handler_ArrayObject) {
1004 "Overloaded object of type %s is not compatible with %s",
1016 if (intern->
ht_iter != (uint32_t)-1) {
1018 intern->
ht_iter = (uint32_t)-1;
1050 spl_array_set_array(
object, intern, array, ar_flags,
ZEND_NUM_ARGS() == 1);
1129 spl_array_set_array(
object, intern, array, 0L, 1);
1149 HashTable *aht = spl_array_get_hash_table(intern);
1150 if (spl_array_is_object(intern)) {
1164 return zend_hash_num_elements(aht);
1174 zend_call_method_with_0_params(
object, intern->
std.
ce, &intern->
fptr_count,
"count", &
rv);
1183 *
count = spl_array_object_count_elements_helper(intern);
1196 RETURN_LONG(spl_array_object_count_elements_helper(intern));
1202 HashTable **ht_ptr = spl_array_get_hash_table_ptr(intern);
1242 zend_array_release(*ht_ptr);
1247 zend_string_free(
Z_STR(function_name));
1251#define SPL_ARRAY_METHOD(cname, fname, use_arg) \
1252PHP_METHOD(cname, fname) \
1254 spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, sizeof(#fname)-1, use_arg); \
1293 smart_str_appendl(&
buf,
"x:", 2);
1298 smart_str_appendc(&
buf,
';');
1302 smart_str_appendl(&
buf,
"m:", 2);
1304 ZVAL_ARR(&members, zend_std_get_properties_ex(&intern->
std));
1322 const unsigned char *
p, *
s;
1324 zval *members, *zflags, *array;
1341 s =
p = (
const unsigned char*)
buf;
1344 if (*
p!=
'x' || *++
p !=
':') {
1373 if (*
p!=
'a' && *
p!=
'O' && *
p!=
'C' && *
p!=
'r') {
1392 spl_array_set_array(
object, intern, array, 0L, 1);
1402 if (*
p!=
'm' || *++
p !=
':') {
1471 zval *flags_zv, *storage_zv, *members_zv, *iterator_class_zv;
1483 if (!flags_zv || !storage_zv || !members_zv ||
1488 "Incomplete or ill-typed serialization data", 0);
1505 spl_array_set_array(
ZEND_THIS, intern, storage_zv, 0L, 1);
1518 "Cannot deserialize ArrayObject with iterator class '%s'; no such class exists",
1525 "Cannot deserialize ArrayObject with iterator class '%s'; this class does not implement the Iterator interface",
1553 uint32_t *pos_ptr = spl_array_get_pos_ptr(aht, intern);
1556 if (spl_array_is_object(intern)) {
1557 return spl_array_skip_protected(intern, aht);
1559 return zend_hash_has_more_elements_ex(aht, pos_ptr);
1565 HashTable *aht = spl_array_get_hash_table(intern);
1567 return spl_array_next_ex(intern, aht);
1580 HashTable *aht = spl_array_get_hash_table(
object);
1581 return zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht,
object));
1589 HashTable *aht = spl_array_get_hash_table(
object);
1608 "Cannot acquire reference to readonly property %s::$%s",
1623 HashTable *aht = spl_array_get_hash_table(
object);
1631 HashTable *aht = spl_array_get_hash_table(
object);
1632 spl_array_next_ex(
object, aht);
1638 HashTable *aht = spl_array_get_hash_table(intern);
1640 if (intern->
ht_iter == (uint32_t)-1) {
1641 spl_array_get_pos_ptr(aht, intern);
1644 spl_array_skip_protected(intern, aht);
1652 spl_array_rewind(
object);
1659 *table = &iter->
data;
1667 spl_array_it_get_current_data,
1668 spl_array_it_get_current_key,
1669 spl_array_it_move_forward,
1670 spl_array_it_rewind,
1672 spl_array_it_get_gc,
1681 iterator->
it.
funcs = &spl_array_it_funcs;
1682 iterator->
by_ref = by_ref;
1684 return &iterator->
it;
1708 spl_array_set_array(
object, intern, array, ar_flags,
ZEND_NUM_ARGS() == 1);
1722 spl_array_rewind(intern);
1732 HashTable *aht = spl_array_get_hash_table(intern);
1741 if (position >= 0) {
1742 spl_array_rewind(intern);
1745 while (position-- > 0 && (
result = spl_array_next(intern)) ==
SUCCESS);
1747 if (
result ==
SUCCESS && zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, intern)) ==
SUCCESS) {
1760 HashTable *aht = spl_array_get_hash_table(intern);
1782 HashTable *aht = spl_array_get_hash_table(intern);
1803 HashTable *aht = spl_array_get_hash_table(intern);
1809 spl_array_next_ex(intern, aht);
1818 HashTable *aht = spl_array_get_hash_table(intern);
1824 RETURN_BOOL(zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, intern)) ==
SUCCESS);
1835 HashTable *aht = spl_array_get_hash_table(intern);
1875 HashTable *aht = spl_array_get_hash_table(intern);
1915 spl_handler_ArrayObject.clone_obj = spl_array_object_clone;
1916 spl_handler_ArrayObject.read_dimension = spl_array_read_dimension;
1917 spl_handler_ArrayObject.write_dimension = spl_array_write_dimension;
1918 spl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;
1919 spl_handler_ArrayObject.has_dimension = spl_array_has_dimension;
1920 spl_handler_ArrayObject.count_elements = spl_array_object_count_elements;
1922 spl_handler_ArrayObject.get_properties_for = spl_array_get_properties_for;
1923 spl_handler_ArrayObject.get_gc = spl_array_get_gc;
1924 spl_handler_ArrayObject.read_property = spl_array_read_property;
1925 spl_handler_ArrayObject.write_property = spl_array_write_property;
1926 spl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;
1927 spl_handler_ArrayObject.has_property = spl_array_has_property;
1928 spl_handler_ArrayObject.unset_property = spl_array_unset_property;
1930 spl_handler_ArrayObject.compare = spl_array_compare_objects;
1931 spl_handler_ArrayObject.free_obj = spl_array_object_free_storage;
count(Countable|array $value, int $mode=COUNT_NORMAL)
natcasesort(array &$array)
ksort(array &$array, int $flags=SORT_REGULAR)
uasort(array &$array, callable $callback)
asort(array &$array, int $flags=SORT_REGULAR)
uksort(array &$array, callable $callback)
zend_ffi_ctype_name_buf buf
#define PHP_MINIT_FUNCTION
unsigned char key[REFLECTION_KEY_LEN]
#define PHP_VAR_UNSERIALIZE_DESTROY(d)
struct php_unserialize_data * php_unserialize_data_t
struct php_serialize_data * php_serialize_data_t
#define PHP_VAR_UNSERIALIZE_INIT(d)
PHPAPI zval * var_tmp_var(php_unserialize_data_t *var_hashx)
PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash)
#define PHP_VAR_SERIALIZE_INIT(d)
PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *data)
#define PHP_VAR_SERIALIZE_DESTROY(d)
php_unserialize_data_t var_hash
void spl_array_iterator_append(zval *object, zval *append_value)
PHPAPI zend_class_entry * spl_ce_RecursiveArrayIterator
PHPAPI zend_class_entry * spl_ce_ArrayIterator
void spl_array_iterator_key(zval *object, zval *return_value)
struct _spl_array_object spl_array_object
struct _spl_array_iterator spl_array_iterator
PHPAPI zend_class_entry * spl_ce_ArrayObject
#define SPL_ARRAY_METHOD(cname, fname, use_arg)
#define SPL_ARRAY_IS_SELF
#define SPL_ARRAY_CLONE_MASK
#define SPL_ARRAY_METHOD_NO_ARG
#define SPL_ARRAY_METHOD_SORT_FLAGS_ARG
#define SPL_ARRAY_STD_PROP_LIST
#define SPL_ARRAY_ARRAY_AS_PROPS
#define SPL_ARRAY_USE_OTHER
#define SPL_ARRAY_CHILD_ARRAYS_ONLY
#define SPL_ARRAY_INT_MASK
#define SPL_ARRAY_METHOD_CALLBACK_ARG
PHPAPI zend_class_entry * spl_ce_UnexpectedValueException
PHPAPI zend_class_entry * spl_ce_OutOfBoundsException
PHPAPI zend_class_entry * spl_ce_InvalidArgumentException
void spl_set_private_debug_info_property(const zend_class_entry *ce, const char *property, size_t property_len, HashTable *debug_info, zval *value)
PHPAPI zend_class_entry * spl_ce_RecursiveIterator
PHPAPI zend_class_entry * spl_ce_SeekableIterator
unsigned char nApplyCount
zend_function * fptr_offset_del
zend_function * fptr_offset_get
zend_function * fptr_offset_set
zend_function * fptr_count
zend_class_entry * ce_get_iterator
HashTable * sentinel_array
zend_function * fptr_offset_has
zend_function * constructor
const zend_object_iterator_funcs * funcs
struct _zend_function::@236135173067030250234125302313220025134003177336 common
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *container, const zval *offset, int type)
#define INTERNAL_FUNCTION_PARAMETERS
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type)
ZEND_API void object_properties_load(zend_object *object, HashTable *properties)
#define RETURN_COPY_DEREF(zv)
ZEND_API void zend_call_known_instance_method_with_2_params(zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2)
#define ZEND_PARSE_PARAMETERS_END()
#define zend_parse_parameters_none()
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define Z_PARAM_CLASS(dest)
#define RETURN_OBJ_COPY(r)
#define call_user_function(function_table, object, function_name, retval_ptr, param_count, params)
#define ZVAL_STRINGL(z, s, l)
exit(string|int $status=0)
zend_string_release_ex(func->internal_function.function_name, 0)
#define ZEND_ACC_READONLY
struct _zend_property_info zend_property_info
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset(const zval *dim)
ZEND_API zend_class_entry * zend_lookup_class(zend_string *name)
#define ZEND_REF_ADD_TYPE_SOURCE(ref, source)
union _zend_function zend_function
ZEND_API HashTable *ZEND_FASTCALL zend_proptable_to_symtable(HashTable *ht, bool always_duplicate)
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
ZEND_API uint32_t ZEND_FASTCALL zend_hash_iterator_add(HashTable *ht, HashPosition pos)
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, const HashPosition *pos)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert(HashTable *ht, zval *pData)
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
ZEND_API zval *ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h)
ZEND_API zval *ZEND_FASTCALL zend_hash_update_ind(HashTable *ht, zend_string *key, zval *pData)
ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, const HashPosition *pos)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData)
ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor)
ZEND_API HashTable *ZEND_FASTCALL zend_array_dup(HashTable *source)
ZEND_API zval *ZEND_FASTCALL zend_hash_update(HashTable *ht, zend_string *key, zval *pData)
ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h)
ZEND_API void ZEND_FASTCALL zend_hash_iterator_del(uint32_t idx)
ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *ht)
#define HASH_KEY_IS_STRING
#define zend_new_array(size)
#define ZEND_HANDLE_NUMERIC(key, idx)
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val)
#define ZEND_HASH_FOREACH_END()
#define HASH_FLAG_HAS_EMPTY_IND
ZEND_API zend_class_entry * zend_ce_countable
ZEND_API zend_class_entry * zend_ce_iterator
ZEND_API zend_class_entry * zend_ce_serializable
ZEND_API zend_class_entry * zend_ce_arrayaccess
ZEND_API zend_class_entry * zend_ce_aggregate
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
struct _zend_object_iterator zend_object_iterator
struct _zend_object_iterator_funcs zend_object_iterator_funcs
ZEND_API zend_object * zend_lazy_object_init(zend_object *obj)
struct _zend_string zend_string
ZEND_API zval * zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *name, int type, void **cache_slot)
ZEND_API HashTable * zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose)
ZEND_API HashTable * zend_std_get_properties(zend_object *zobj)
ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot)
ZEND_API const zend_object_handlers std_object_handlers
ZEND_API zval * zend_std_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot)
ZEND_API zend_property_info * zend_get_property_info(const zend_class_entry *ce, zend_string *member, int silent)
ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void **cache_slot)
ZEND_API zval * zend_std_read_property(zend_object *zobj, zend_string *name, int type, void **cache_slot, zval *rv)
ZEND_API int zend_std_compare_objects(zval *o1, zval *o2)
#define ZEND_WRONG_PROPERTY_INFO
enum _zend_prop_purpose zend_prop_purpose
HashTable *(* zend_object_get_properties_t)(zend_object *object)
@ ZEND_PROP_PURPOSE_ARRAY_CAST
@ ZEND_PROP_PURPOSE_VAR_EXPORT
#define ZEND_PROPERTY_EXISTS
#define ZEND_COMPARE_OBJECTS_FALLBACK(op1, op2)
ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object, zend_object *old_object)
ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce)
ZEND_API void zend_object_std_dtor(zend_object *object)
ZEND_API zend_string *ZEND_FASTCALL zend_long_to_str(zend_long num)
ZEND_API bool ZEND_FASTCALL zend_is_true(const zval *op)
ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2)
#define zend_never_inline
#define EXPECTED(condition)
#define zend_always_inline
#define XtOffsetOf(s_type, field)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
#define ZSTR_EMPTY_ALLOC()
#define Z_OBJ_HANDLER_P(zv_p, hf)
#define Z_ISREF_P(zval_p)
#define Z_TRY_ADDREF_P(pz)
#define ZVAL_NEW_EMPTY_REF(z)
#define GC_SET_REFCOUNT(p, rc)
#define Z_ISUNDEF_P(zval_p)
#define Z_ARRVAL_P(zval_p)
#define ZVAL_STR_COPY(z, s)
struct _zend_array HashTable
#define Z_OBJ_HT_P(zval_p)
#define ZVAL_NEW_REF(z, r)
#define Z_OBJCE_P(zval_p)
void(* copy_ctor_func_t)(zval *pElement)
#define ZEND_TYPE_IS_SET(t)
#define Z_INDIRECT_P(zval_p)
#define ZVAL_OBJ_COPY(z, o)
ZEND_RESULT_CODE zend_result
#define IS_ARRAY_IMMUTABLE
struct _zend_object_handlers zend_object_handlers
#define SEPARATE_ARRAY(zv)
#define ZVAL_COPY_VALUE(z, v)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
ZEND_API void zval_add_ref(zval *p)
zend_property_info * prop_info
fbc internal_function handler(call, ret)
zend_refcounted * garbage