return spl_array_has_dimension_ex(1, object, offset, check_empty);
} /* }}} */
-/* {{{ spl_array_object_verify_pos_ex */
-static inline int spl_array_object_verify_pos_ex(spl_array_object *object, HashTable *ht, const char *msg_prefix)
-{
- if (!ht) {
- php_error_docref(NULL, E_NOTICE, "%sArray was modified outside object and is no longer an array", msg_prefix);
- return FAILURE;
- }
-
- return SUCCESS;
-} /* }}} */
-
-/* {{{ spl_array_object_verify_pos */
-static inline int spl_array_object_verify_pos(spl_array_object *object, HashTable *ht)
-{
- return spl_array_object_verify_pos_ex(object, ht, "");
-} /* }}} */
-
/* {{{ proto bool ArrayObject::offsetExists(mixed $index)
proto bool ArrayIterator::offsetExists(mixed $index)
Returns whether the requested $index exists. */
void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
- HashTable *aht = spl_array_get_hash_table(intern);
-
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
if (spl_array_is_object(intern)) {
zend_throw_error(NULL, "Cannot append properties to objects, use %s::offsetSet() instead", ZSTR_VAL(Z_OBJCE_P(object)->name));
if (object->ar_flags & SPL_ARRAY_OVERLOADED_VALID) {
return zend_user_it_valid(iter);
} else {
- if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::valid(): ") == FAILURE) {
- return FAILURE;
- }
-
return zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, object));
}
}
if (object->ar_flags & SPL_ARRAY_OVERLOADED_KEY) {
zend_user_it_get_current_key(iter, key);
} else {
- if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::current(): ") == FAILURE) {
- ZVAL_NULL(key);
- } else {
- zend_hash_get_current_key_zval_ex(aht, key, spl_array_get_pos_ptr(aht, object));
- }
+ zend_hash_get_current_key_zval_ex(aht, key, spl_array_get_pos_ptr(aht, object));
}
}
/* }}} */
zend_user_it_move_forward(iter);
} else {
zend_user_it_invalidate_current(iter);
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and is no longer an array");
- return;
- }
-
spl_array_next_ex(object, aht);
}
}
{
HashTable *aht = spl_array_get_hash_table(intern);
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "ArrayIterator::rewind(): Array was modified outside object and is no longer an array");
- return;
- }
-
if (intern->ht_iter == (uint32_t)-1) {
spl_array_get_pos_ptr(aht, intern);
} else {
{
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
- HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0));
}
/* }}} */
return;
}
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
opos = position;
if (position >= 0) { /* negative values are not supported */
HashTable *aht = spl_array_get_hash_table(intern);
HashPosition pos, *pos_ptr;
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "Array was modified outside object and is no longer an array");
- *count = 0;
- return FAILURE;
- }
-
if (spl_array_is_object(intern)) {
/* We need to store the 'pos' since we'll modify it in the functions
* we're going to call and which do not support 'pos' as parameter. */
return;
}
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- return;
- }
-
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
return;
}
spl_array_object *intern = Z_SPLARRAY_P(object);
HashTable *aht = spl_array_get_hash_table(intern);
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- return;
- }
-
zend_hash_get_current_key_zval_ex(aht, return_value, spl_array_get_pos_ptr(aht, intern));
}
/* }}} */
return;
}
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- return;
- }
-
spl_array_next_ex(intern, aht);
}
/* }}} */
return;
}
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- RETURN_FALSE;
- } else {
- RETURN_BOOL(zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, intern)) == SUCCESS);
- }
+ RETURN_BOOL(zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, intern)) == SUCCESS);
}
/* }}} */
return;
}
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- RETURN_FALSE;
- }
-
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
RETURN_FALSE;
}
return;
}
- if (spl_array_object_verify_pos(intern, aht) == FAILURE) {
- return;
- }
-
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
return;
}
{
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
- HashTable *aht = spl_array_get_hash_table(intern);
zval members, flags;
php_serialize_data_t var_hash;
smart_str buf = {0};
return;
}
- if (!aht) {
- php_error_docref(NULL, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
PHP_VAR_SERIALIZE_INIT(var_hash);
ZVAL_LONG(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK));