From 39b256d8a981d4b1eb250043803acac8d82c1829 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 16 Dec 2015 16:33:26 +0100 Subject: [PATCH] flush --- Makefile.frag | 4 ++-- php_psi.h | 6 +++--- src/module.c | 27 ++++++++++++++------------- tests/glob/glob002.phpt | 16 ++++++++++------ 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index e1aecfe..c6ce97d 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -17,10 +17,10 @@ psi-clean-headers: -rm -f $(PHP_PSI_HEADERS) lempar.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=3617143ddb9b176c3605defe6a9c798793280120" + curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=3ec1463a034b37d87d782be5f6b8b10a3b1ecbe7" lemon.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=039f813b520b9395740c52f9cbf36c90b5d8df03" + curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=799e73e19a33b8dd7767a7fa34618ed2a9c2397d" ./lemon: lemon.c | lempar.c $(CC) -o $@ $< diff --git a/php_psi.h b/php_psi.h index 85a3805..367739a 100644 --- a/php_psi.h +++ b/php_psi.h @@ -59,12 +59,12 @@ void psi_to_object(zval *return_value, set_value *set, impl_val *ret_val); void psi_call(zend_execute_data *execute_data, zval *return_value, impl *impl); -int psi_calc_num_exp(num_exp *exp, impl_val *ref, impl_val *res); +int psi_calc_num_exp(num_exp *exp, impl_val *strct, impl_val *res); -static inline zend_long psi_long_num_exp(num_exp *exp, impl_val *ref) { +static inline zend_long psi_long_num_exp(num_exp *exp, impl_val *strct) { impl_val val = {0}; - switch (psi_calc_num_exp(exp, ref, &val)) { + switch (psi_calc_num_exp(exp, strct, &val)) { case PSI_T_UINT8: return val.u8; case PSI_T_UINT16: return val.u16; case PSI_T_UINT32: return val.u32; diff --git a/src/module.c b/src/module.c index 53079d0..57c9399 100644 --- a/src/module.c +++ b/src/module.c @@ -286,7 +286,7 @@ void psi_to_string(zval *return_value, set_value *set, impl_val *ret_val) ret_val = deref_impl_val(ret_val, var); if (ret_val && ret_val->ptr) { if (set->num) { - RETVAL_STRINGL(ret_val->ptr, psi_long_num_exp(set->num, NULL)); + RETVAL_STRINGL(ret_val->ptr, psi_long_num_exp(set->num, set->outer.val)); } else { RETVAL_STRING(ret_val->ptr); } @@ -514,10 +514,10 @@ static inline ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, i if (i < EX_NUM_ARGS()) { iarg->_zv = ++zarg; ZVAL_DEREF(iarg->_zv); - if (iarg->var->reference) { - zval_dtor(iarg->_zv); - ZVAL_NULL(iarg->_zv); - } +// if (iarg->var->reference) { +// zval_dtor(iarg->_zv); +// ZVAL_NULL(iarg->_zv); +// } } if (iarg->def) { @@ -698,6 +698,7 @@ static inline void *psi_do_let(let_stmt *let) static inline void psi_do_set(zval *return_value, set_value *set) { + zval_dtor(return_value); set->func->handler(return_value, set, set->vars->vars[0]->arg->ptr); } @@ -766,8 +767,8 @@ static inline void psi_do_clean(impl *impl) } } -static inline int psi_calc_num_exp_value(num_exp *exp, impl_val *ref, impl_val *res) { - impl_val *tmp = NULL; +static inline int psi_calc_num_exp_value(num_exp *exp, impl_val *strct, impl_val *res) { + impl_val *ref, *tmp = NULL; switch (exp->t) { case PSI_T_NUMBER: @@ -793,10 +794,10 @@ static inline int psi_calc_num_exp_value(num_exp *exp, impl_val *ref, impl_val * break; case PSI_T_NAME: - if (1) { - ref = exp->u.dvar->arg->ptr; + if (strct) { + ref = struct_member_ref(exp->u.dvar->arg, strct, &tmp); } else { - ref = struct_member_ref(exp->u.dvar->arg, ref, &tmp); + ref = exp->u.dvar->arg->ptr; } switch (real_decl_type(exp->u.dvar->arg->type)->type) { case PSI_T_INT8: @@ -830,13 +831,13 @@ static inline int psi_calc_num_exp_value(num_exp *exp, impl_val *ref, impl_val * return 0; } -int psi_calc_num_exp(num_exp *exp, impl_val *ref, impl_val *res) { +int psi_calc_num_exp(num_exp *exp, impl_val *strct, impl_val *res) { impl_val num = {0}; - int num_type = psi_calc_num_exp_value(exp, ref, &num); + int num_type = psi_calc_num_exp_value(exp, strct, &num); if (exp->operand) { impl_val tmp = {0}; - int tmp_type = psi_calc_num_exp(exp->operand, ref, &tmp); + int tmp_type = psi_calc_num_exp(exp->operand, strct, &tmp); return exp->calculator(num_type, &num, tmp_type, &tmp, res); } diff --git a/tests/glob/glob002.phpt b/tests/glob/glob002.phpt index 17bad44..4ac964a 100644 --- a/tests/glob/glob002.phpt +++ b/tests/glob/glob002.phpt @@ -11,7 +11,7 @@ PHP_OS === "Linux" or die("skip - only for Linux"); ===TEST=== 3]; +$glob = ["gl_offs" => 5]; var_dump(psi\glob("*.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob)); var_dump($glob); ?> @@ -23,11 +23,11 @@ array(4) { ["gl_pathc"]=> int(4) ["gl_offs"]=> - int(3) + int(5) ["gl_flags"]=> int(%d) ["gl_pathv"]=> - array(7) { + array(9) { [0]=> string(0) "" [1]=> @@ -35,12 +35,16 @@ array(4) { [2]=> string(0) "" [3]=> - string(11) "glob002.php" + string(0) "" [4]=> - string(12) "glob001.phpt" + string(0) "" [5]=> - string(12) "glob002.phpt" + string(11) "glob002.php" [6]=> + string(12) "glob001.phpt" + [7]=> + string(12) "glob002.phpt" + [8]=> string(12) "glob003.phpt" } } -- 2.30.2