return & break inside an expression do not cause the current route
block or while/switch statement to end.
E.g.: $v = { return 1; } will not end the current route, will
only set $v to 1.
... | ... |
@@ -107,9 +107,11 @@ inline static int lval_avp_assign(struct run_act_ctx* h, struct sip_msg* msg, |
107 | 107 |
break; |
108 | 108 |
case RV_ACTION_ST: |
109 | 109 |
flags=avp->type & ~AVP_VAL_STR; |
110 |
- if (rv->v.action) |
|
110 |
+ if (rv->v.action) { |
|
111 | 111 |
value.n=run_actions_safe(h, rv->v.action, msg); |
112 |
- else |
|
112 |
+ h->run_flags &= ~(RETURN_R_F|BREAK_R_F); /* catch return & |
|
113 |
+ break in expr*/ |
|
114 |
+ } else |
|
113 | 115 |
value.n=-1; |
114 | 116 |
ret=value.n; |
115 | 117 |
break; |
... | ... |
@@ -282,9 +284,11 @@ inline static int lval_pvar_assign(struct run_act_ctx* h, struct sip_msg* msg, |
282 | 284 |
break; |
283 | 285 |
case RV_ACTION_ST: |
284 | 286 |
pval.flags=PV_TYPE_INT|PV_VAL_INT; |
285 |
- if (rv->v.action) |
|
287 |
+ if (rv->v.action) { |
|
286 | 288 |
pval.ri=run_actions_safe(h, rv->v.action, msg); |
287 |
- else |
|
289 |
+ h->run_flags &= ~(RETURN_R_F|BREAK_R_F); /* catch return & |
|
290 |
+ break in expr*/ |
|
291 |
+ } else |
|
288 | 292 |
pval.ri=0; |
289 | 293 |
ret=pval.ri; |
290 | 294 |
break; |
... | ... |
@@ -900,9 +900,11 @@ int rval_get_int(struct run_act_ctx* h, struct sip_msg* msg, |
900 | 900 |
} |
901 | 901 |
break; |
902 | 902 |
case RV_ACTION_ST: |
903 |
- if (rv->v.action) |
|
903 |
+ if (rv->v.action) { |
|
904 | 904 |
*i=(run_actions_safe(h, rv->v.action, msg)>0); |
905 |
- else |
|
905 |
+ h->run_flags &= ~(RETURN_R_F|BREAK_R_F); /* catch return & |
|
906 |
+ break in expr*/ |
|
907 |
+ } else |
|
906 | 908 |
*i=0; |
907 | 909 |
break; |
908 | 910 |
case RV_SEL: |
... | ... |
@@ -1099,9 +1101,11 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg, |
1099 | 1101 |
*tmpv=rv->v.s; |
1100 | 1102 |
break; |
1101 | 1103 |
case RV_ACTION_ST: |
1102 |
- if (rv->v.action) |
|
1104 |
+ if (rv->v.action) { |
|
1103 | 1105 |
i=(run_actions_safe(h, rv->v.action, msg)>0); |
1104 |
- else |
|
1106 |
+ h->run_flags &= ~(RETURN_R_F|BREAK_R_F); /* catch return & |
|
1107 |
+ break in expr*/ |
|
1108 |
+ } else |
|
1105 | 1109 |
i=0; |
1106 | 1110 |
tmpv->s=sint2strbuf(i, tmp_cache->i2s, |
1107 | 1111 |
sizeof(tmp_cache->i2s), &tmpv->len); |