From 7b38766928d124d255fb45c19fdca97352ed6881 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 14 Jul 2011 12:15:50 +0100 Subject: [PATCH] Handle numeric keys for array elements too. --- twig.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/twig.c b/twig.c index b43f16b..f62b133 100644 --- a/twig.c +++ b/twig.c @@ -125,7 +125,7 @@ int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key) return 0; } convert_to_string(key); - if (zend_hash_find(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &dummy) == SUCCESS) { + if (zend_symtable_find(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &dummy) == SUCCESS) { return 1; } return 0; @@ -276,9 +276,10 @@ zval *TWIG_GET_ARRAY_ELEMENT_ZVAL(zval *class, zval *prop_name) } return NULL; } - tmp_name = Z_STRVAL_P(prop_name); - if (zend_hash_find(HASH_OF(class), tmp_name, strlen(tmp_name)+1, (void**) &tmp_zval) == SUCCESS) { + convert_to_string(prop_name); + tmp_name = Z_STRVAL_P(prop_name); + if (zend_symtable_find(HASH_OF(class), tmp_name, strlen(tmp_name)+1, (void**) &tmp_zval) == SUCCESS) { return *tmp_zval; } return NULL; @@ -304,7 +305,7 @@ zval *TWIG_GET_ARRAY_ELEMENT(zval *class, char *prop_name, int prop_name_length) return tmp_ret_zval; } - if (zend_hash_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { + if (zend_symtable_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { return *tmp_zval; } return NULL; -- 1.7.2.5