gaaf left a comment (kamailio/kamailio#4444)
> the scripting language interpreter tries to autoconvert right-side of an
> expression to the type discovered for the left side.
But that fails if the left side has no unambiguous type.
```
0 + $rP; # 3 correct
$rP + 0; # "tls0" WRONG!
```
In the 1st expression, the left side is an integer, so it is logical the result
becomes an integer too.
In the 2nd expression, the left side ($rP) has `res->flags =
PV_VAL_STR|PV_VAL_INT;`. Thus it is both a string and integer. Maybe in that
case the interpreter should look at the type of the next item in the expression?
In short, maybe the interpreter should search for the first item that has a
single type?
Do you have any idea why case 2 fails so badly? Is this also the script
interpreter or something else? I would expect the `{s.int}` transformation to
apply first, resulting in an int of value 3, and then string expansion
converting the int to a string "3".
`xinfo("Target proto 2: $(rP{s.int})"); # "tls"`
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4444#issuecomment-3436035884
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4444/[email protected]>_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!