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;
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);
}
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) {
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);
}
}
}
-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:
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:
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);
}
===TEST===
<?php
chdir(__DIR__);
-$glob = ["gl_offs" => 3];
+$glob = ["gl_offs" => 5];
var_dump(psi\glob("*.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob));
var_dump($glob);
?>
["gl_pathc"]=>
int(4)
["gl_offs"]=>
- int(3)
+ int(5)
["gl_flags"]=>
int(%d)
["gl_pathv"]=>
- array(7) {
+ array(9) {
[0]=>
string(0) ""
[1]=>
[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"
}
}