|
|
|
@ -545,7 +545,7 @@ static int spl_array_has_dimension(zval *object, zval *offset, int check_empty T |
|
|
|
|
|
|
|
/* {{{ proto bool ArrayObject::offsetExists(mixed $index) U |
|
|
|
proto bool ArrayIterator::offsetExists(mixed $index) U |
|
|
|
Returns whether the requested $index exists. */ |
|
|
|
Returns whether the requested $index exists. */ |
|
|
|
SPL_METHOD(Array, offsetExists) |
|
|
|
{ |
|
|
|
zval *index; |
|
|
|
@ -557,7 +557,7 @@ SPL_METHOD(Array, offsetExists) |
|
|
|
|
|
|
|
/* {{{ proto mixed ArrayObject::offsetGet(mixed $index) U |
|
|
|
proto mixed ArrayIterator::offsetGet(mixed $index) U |
|
|
|
Returns the value at the specified $index. */ |
|
|
|
Returns the value at the specified $index. */ |
|
|
|
SPL_METHOD(Array, offsetGet) |
|
|
|
{ |
|
|
|
zval *index, *value; |
|
|
|
@ -570,7 +570,7 @@ SPL_METHOD(Array, offsetGet) |
|
|
|
|
|
|
|
/* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval) U |
|
|
|
proto void ArrayIterator::offsetSet(mixed $index, mixed $newval) U |
|
|
|
Sets the value at the specified $index to $newval. */ |
|
|
|
Sets the value at the specified $index to $newval. */ |
|
|
|
SPL_METHOD(Array, offsetSet) |
|
|
|
{ |
|
|
|
zval *index, *value; |
|
|
|
@ -603,7 +603,7 @@ void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{ |
|
|
|
|
|
|
|
/* {{{ proto void ArrayObject::append(mixed $newval) U |
|
|
|
proto void ArrayIterator::append(mixed $newval) U |
|
|
|
Appends the value (cannot be called for objects). */ |
|
|
|
Appends the value (cannot be called for objects). */ |
|
|
|
SPL_METHOD(Array, append) |
|
|
|
{ |
|
|
|
zval *value; |
|
|
|
@ -616,7 +616,7 @@ SPL_METHOD(Array, append) |
|
|
|
|
|
|
|
/* {{{ proto void ArrayObject::offsetUnset(mixed $index) U |
|
|
|
proto void ArrayIterator::offsetUnset(mixed $index) U |
|
|
|
Unsets the value at the specified $index. */ |
|
|
|
Unsets the value at the specified $index. */ |
|
|
|
SPL_METHOD(Array, offsetUnset) |
|
|
|
{ |
|
|
|
zval *index; |
|
|
|
@ -628,12 +628,12 @@ SPL_METHOD(Array, offsetUnset) |
|
|
|
|
|
|
|
/* {{{ proto array ArrayObject::getArrayCopy() U |
|
|
|
proto array ArrayIterator::getArrayCopy() U |
|
|
|
Return a copy of the contained array */ |
|
|
|
Return a copy of the contained array */ |
|
|
|
SPL_METHOD(Array, getArrayCopy) |
|
|
|
{ |
|
|
|
zval *object = getThis(), *tmp; |
|
|
|
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); |
|
|
|
|
|
|
|
|
|
|
|
array_init(return_value); |
|
|
|
zend_hash_copy(HASH_OF(return_value), spl_array_get_hash_table(intern, 0 TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*)); |
|
|
|
} /* }}} */ |
|
|
|
@ -992,7 +992,7 @@ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, |
|
|
|
|
|
|
|
/* {{{ proto void ArrayObject::__construct(array|object ar = array() [, int flags = 0 [, string iterator_class = "ArrayIterator"]]) U |
|
|
|
proto void ArrayIterator::__construct(array|object ar = array() [, int flags = 0]) U |
|
|
|
Cronstructs a new array iterator from a path. */ |
|
|
|
Constructs a new array iterator from a path. */ |
|
|
|
SPL_METHOD(Array, __construct) |
|
|
|
{ |
|
|
|
zval *object = getThis(); |
|
|
|
@ -1129,7 +1129,7 @@ SPL_METHOD(Array, rewind) |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto void ArrayIterator::seek(int $position) U |
|
|
|
Seek to position. */ |
|
|
|
Seek to position. */ |
|
|
|
SPL_METHOD(Array, seek) |
|
|
|
{ |
|
|
|
long opos, position; |
|
|
|
@ -1213,7 +1213,7 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::count() U |
|
|
|
proto int ArrayIterator::count() U |
|
|
|
Return the number of elements in the Iterator. */ |
|
|
|
Return the number of elements in the Iterator. */ |
|
|
|
SPL_METHOD(Array, count) |
|
|
|
{ |
|
|
|
long count; |
|
|
|
@ -1223,7 +1223,8 @@ SPL_METHOD(Array, count) |
|
|
|
RETURN_LONG(count); |
|
|
|
} /* }}} */ |
|
|
|
|
|
|
|
/* {{{ static void spl_array_method */ |
|
|
|
/* {{{ static void spl_array_method |
|
|
|
*/ |
|
|
|
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) |
|
|
|
{ |
|
|
|
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); |
|
|
|
@ -1258,32 +1259,32 @@ SPL_METHOD(cname, fname) \ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::asort() U |
|
|
|
proto int ArrayIterator::asort() U |
|
|
|
Sort the entries by values. */ |
|
|
|
Sort the entries by values. */ |
|
|
|
SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::ksort() U |
|
|
|
proto int ArrayIterator::ksort() U |
|
|
|
Sort the entries by key. */ |
|
|
|
Sort the entries by key. */ |
|
|
|
SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::uasort(callback cmp_function) U |
|
|
|
proto int ArrayIterator::uasort(callback cmp_function) U |
|
|
|
Sort the entries by values user defined function. */ |
|
|
|
Sort the entries by values user defined function. */ |
|
|
|
SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::uksort(callback cmp_function) U |
|
|
|
proto int ArrayIterator::uksort(callback cmp_function) U |
|
|
|
Sort the entries by key using user defined function. */ |
|
|
|
Sort the entries by key using user defined function. */ |
|
|
|
SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::natsort() U |
|
|
|
proto int ArrayIterator::natsort() U |
|
|
|
Sort the entries by values using "natural order" algorithm. */ |
|
|
|
Sort the entries by values using "natural order" algorithm. */ |
|
|
|
SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto int ArrayObject::natcasesort() U |
|
|
|
proto int ArrayIterator::natcasesort() U |
|
|
|
Sort the entries by key using case insensitive "natural order" algorithm. */ |
|
|
|
Sort the entries by key using case insensitive "natural order" algorithm. */ |
|
|
|
SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto mixed|NULL ArrayIterator::current() U |
|
|
|
@ -1458,7 +1459,8 @@ SPL_METHOD(Array, getChildren) |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
smart_str spl_array_serialize_helper(spl_array_object *intern, php_serialize_data_t *var_hash_p TSRMLS_DC) { /* {{{ */ |
|
|
|
smart_str spl_array_serialize_helper(spl_array_object *intern, php_serialize_data_t *var_hash_p TSRMLS_DC) /* {{{ */ |
|
|
|
{ |
|
|
|
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); |
|
|
|
zval members, *pmembers; |
|
|
|
smart_str buf = {0}; |
|
|
|
@ -1495,8 +1497,7 @@ smart_str spl_array_serialize_helper(spl_array_object *intern, php_serialize_dat |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto string ArrayObject::serialize() |
|
|
|
* serialize the object |
|
|
|
*/ |
|
|
|
Serialize the object */ |
|
|
|
SPL_METHOD(Array, serialize) |
|
|
|
{ |
|
|
|
zval *object = getThis(); |
|
|
|
@ -1524,7 +1525,8 @@ SPL_METHOD(Array, serialize) |
|
|
|
RETURN_NULL(); |
|
|
|
} /* }}} */ |
|
|
|
|
|
|
|
int spl_array_serialize(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) { /* {{{ */ |
|
|
|
int spl_array_serialize(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ |
|
|
|
{ |
|
|
|
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); |
|
|
|
|
|
|
|
if (intern->fptr_serialize) { |
|
|
|
@ -1557,7 +1559,8 @@ int spl_array_serialize(zval *object, int *type, zstr *buffer, zend_uint *buf_le |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
void spl_array_unserialize_helper(spl_array_object *intern, const unsigned char *buf, zend_uint buf_len, php_unserialize_data_t *var_hash_p TSRMLS_DC) { /* {{{ */ |
|
|
|
void spl_array_unserialize_helper(spl_array_object *intern, const unsigned char *buf, zend_uint buf_len, php_unserialize_data_t *var_hash_p TSRMLS_DC) /* {{{ */ |
|
|
|
{ |
|
|
|
const unsigned char *p, *s; |
|
|
|
zval *pmembers, *pflags = NULL; |
|
|
|
long flags; |
|
|
|
@ -1632,10 +1635,7 @@ outexcept: |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto void ArrayObject::unserialize(string serialized) |
|
|
|
* |
|
|
|
* |
|
|
|
* unserialize the object |
|
|
|
*/ |
|
|
|
Unserialize the object */ |
|
|
|
SPL_METHOD(Array, unserialize) |
|
|
|
{ |
|
|
|
char *buf; |
|
|
|
@ -1667,7 +1667,8 @@ SPL_METHOD(Array, unserialize) |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
int spl_array_unserialize(zval **object, zend_class_entry *ce, int type, const zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) { /* {{{ */ |
|
|
|
int spl_array_unserialize(zval **object, zend_class_entry *ce, int type, const zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ |
|
|
|
{ |
|
|
|
spl_array_object *intern; |
|
|
|
|
|
|
|
object_init_ex(*object, ce); |
|
|
|
|