flush
authorMichael Wallner <mike@php.net>
Wed, 16 Dec 2015 15:33:26 +0000 (16:33 +0100)
committerMichael Wallner <mike@php.net>
Wed, 16 Dec 2015 15:33:26 +0000 (16:33 +0100)
Makefile.frag
php_psi.h
src/module.c
tests/glob/glob002.phpt

index e1aecfe2bc8794a767811645d79de6322b0d0588..c6ce97d84e1b14d809683dd7d7e8c69ed97e7afd 100644 (file)
@@ -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 $@ $<
index 85a3805811f58440d49476f81d0453b8fc6d666f..367739acc0ef237285d111bd58509c58aa4b797f 100644 (file)
--- 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;
index 53079d0a1293771ea8b74001595224a7f6ef1350..57c93993f980c700a9bf1a5a400d74dd9f9ad6cc 100644 (file)
@@ -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);
        }
index 17bad44b70f0dc4ec68c88d93f004d1993bbe576..4ac964a154b27af0ad0ca90e63b5d92946797dd5 100644 (file)
@@ -11,7 +11,7 @@ PHP_OS === "Linux" or die("skip - only for Linux");
 ===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);
 ?>
@@ -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"
   }
 }