diff options
author | Marcus Boerger <helly@php.net> | 2006-05-11 21:07:39 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2006-05-11 21:07:39 +0000 |
commit | 7a5240e84671ca093e69048f5592d612e1b13aa3 (patch) | |
tree | b990aecf4770a8199f0d765b3d32bac971f1b80e /Zend/zend_interfaces.c | |
parent | b636a534c12a08297e86469467f1289e83db85a9 (diff) | |
download | php-git-7a5240e84671ca093e69048f5592d612e1b13aa3.tar.gz |
- MFH missing bits and pieces of the partial sync with head
# This time i added:
# ZEND_FE_RESET_VARIABLE
# ZEND_FE_RESET_REFERENCE
# and dapted parser,compiler,executor,interfaces to handle these flags
# their purpose is to be able to pass whetehr foreach is done by ref to
# the current() handler so that it can error out in case it is not capable
# to comply to the requested return signature/protocol/semantics (weyp).
Diffstat (limited to 'Zend/zend_interfaces.c')
-rwxr-xr-x | Zend/zend_interfaces.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index b5e9ab6999..74441b3e10 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -200,8 +200,8 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st } return HASH_KEY_IS_LONG; } - switch (retval->type) { - default: + switch (Z_TYPE_P(retval)) { + default: zend_error(E_WARNING, "Illegal type returned from %s::key()", iter->ce->name); case IS_NULL: *int_key = 0; @@ -209,21 +209,20 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st return HASH_KEY_IS_LONG; case IS_STRING: - *str_key = estrndup(retval->value.str.val, retval->value.str.len); - *str_key_len = retval->value.str.len+1; + *str_key = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + *str_key_len = Z_STRLEN_P(retval)+1; zval_ptr_dtor(&retval); return HASH_KEY_IS_STRING; case IS_DOUBLE: + *int_key = (long)Z_DVAL_P(retval); + zval_ptr_dtor(&retval); + return HASH_KEY_IS_LONG; + case IS_RESOURCE: case IS_BOOL: - case IS_LONG: { - if (retval->type == IS_DOUBLE) { - *int_key = (long)retval->value.dval; - } else { - *int_key = retval->value.lval; - } - } + case IS_LONG: + *int_key = (long)Z_LVAL_P(retval); zval_ptr_dtor(&retval); return HASH_KEY_IS_LONG; } |