Browse Source

Fix return value to match std array func behavior

PEAR_1_4DEV
Marcus Boerger 22 years ago
parent
commit
af9788eb32
  1. 10
      ext/spl/spl_array.c

10
ext/spl/spl_array.c

@ -408,7 +408,7 @@ SPL_METHOD(Array, rewind)
}
/* }}} */
/* {{{ proto mixed|false ArrayIterator::current()
/* {{{ proto mixed|NULL ArrayIterator::current()
Return current array entry */
SPL_METHOD(Array, current)
{
@ -424,18 +424,18 @@ SPL_METHOD(Array, current)
if (intern->array->is_ref && spl_hash_pos_exists(intern TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
RETURN_FALSE;
return;
}
if (zend_hash_get_current_data_ex(aht, (void **) &entry, &intern->pos) == FAILURE) {
RETURN_FALSE;
return;
}
*return_value = **entry;
zval_copy_ctor(return_value);
}
/* }}} */
/* {{{ proto mixed|false ArrayIterator::key()
/* {{{ proto mixed|NULL ArrayIterator::key()
Return current array key */
SPL_METHOD(Array, key)
{
@ -453,7 +453,7 @@ SPL_METHOD(Array, key)
if (intern->array->is_ref && spl_hash_pos_exists(intern TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
RETURN_FALSE;
return;
}
switch (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 0, &intern->pos)) {

Loading…
Cancel
Save