[SR-Users] Consistency: -1 sometimes true, sometimes false
Sebastian Damm
damm at sipgate.de
Wed Aug 23 09:42:56 CEST 2017
Hi,
we recently stumbled upon the following problem:
We had something like this in our route:
$var(ret) = allow_address("2");
if ($var(ret)) {
do_something;
}
Turns out, this always evaluates to true, no matter whether the IP
address really is in address group 2 or not. The values in $var(ret)
are 1 or -1, depending on the outcome of allow_address().
However, if we write it this way
if (allow_address("2")) {
do_something;
}
the code inside is only executed if the IP address is in address group 2.
Is this some kind of inconsistency? Should negative values in
variables evaluate to true or false?
Best Regards,
Sebastian
More information about the sr-users
mailing list