summaryrefslogtreecommitdiff
path: root/ext/pdo
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2013-02-16 19:13:36 +0100
committerNikita Popov <nikic@php.net>2013-03-12 17:27:31 +0100
commitfcc6611de9054327441786e52444b5f8eecdd525 (patch)
tree072a133a6e3ea1c067d9ad30cb07bb8130691094 /ext/pdo
parent8436342d8861650930f985249ce3da7f92f03506 (diff)
downloadphp-git-fcc6611de9054327441786e52444b5f8eecdd525.tar.gz
Add support for non-scalar Iterator keys in foreach
RFC: https://wiki.php.net/rfc/foreach-non-scalar-keys
Diffstat (limited to 'ext/pdo')
-rw-r--r--ext/pdo/pdo_stmt.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 5dc445ff8d..1b0db91c38 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2499,16 +2499,15 @@ static void pdo_stmt_iter_get_data(zend_object_iterator *iter, zval ***data TSRM
*data = &I->fetch_ahead;
}
-static int pdo_stmt_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
- ulong *int_key TSRMLS_DC)
+static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter->data;
if (I->key == (ulong)-1) {
- return HASH_KEY_NON_EXISTANT;
+ ZVAL_NULL(key);
+ } else {
+ ZVAL_LONG(key, I->key);
}
- *int_key = I->key;
- return HASH_KEY_IS_LONG;
}
static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)