summaryrefslogtreecommitdiff
path: root/src/sp_var_value.c
diff options
context:
space:
mode:
authorjvoisin2018-01-12 18:58:22 +0100
committerjvoisin2018-01-12 18:58:22 +0100
commite61e3c24152fe0a236001726baa0c9537b704100 (patch)
treebbff9be391be14d812804cf649910c5ca55d417a /src/sp_var_value.c
parentcc258187dcc75c5e343310127a318f0bce984fa7 (diff)
Refactor to improve the scoping
Diffstat (limited to 'src/sp_var_value.c')
-rw-r--r--src/sp_var_value.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c
index 9a23ad9..c56c28f 100644
--- a/src/sp_var_value.c
+++ b/src/sp_var_value.c
@@ -92,19 +92,20 @@ static void *get_entry_hashtable(const HashTable *ht, const char *entry,
92 92
93static zval *get_array_value(zend_execute_data *ed, zval *zvalue, 93static zval *get_array_value(zend_execute_data *ed, zval *zvalue,
94 const sp_tree *tree) { 94 const sp_tree *tree) {
95 zval *idx_value, *ret = NULL; 95 zval *idx_value = get_value(ed, tree->idx, false);
96 char *idx = NULL;
97 96
98 idx_value = get_value(ed, tree->idx, false);
99 if (!zvalue || !idx_value) { 97 if (!zvalue || !idx_value) {
100 return NULL; 98 return NULL;
101 } 99 }
100
102 if (Z_TYPE_P(zvalue) == IS_ARRAY) { 101 if (Z_TYPE_P(zvalue) == IS_ARRAY) {
103 idx = sp_convert_to_string(idx_value); 102 char *idx = sp_convert_to_string(idx_value);
104 ret = get_entry_hashtable(Z_ARRVAL_P(zvalue), idx, strlen(idx)); 103 zval *ret = get_entry_hashtable(Z_ARRVAL_P(zvalue), idx, strlen(idx));
105 efree(idx); 104 efree(idx);
105 return ret;
106 } 106 }
107 return ret; 107
108 return NULL;
108} 109}
109 110
110static zval *get_object_property(zend_execute_data *ed, zval *object, 111static zval *get_object_property(zend_execute_data *ed, zval *object,