[OpenSER-Users] is_uri_host_local() returns 1 or 4294967295 (always TRUE !!!)

Daniel-Constantin Mierla daniel at voice-system.ro
Thu Sep 6 19:36:20 CEST 2007


On 09/06/07 11:05, Iñaki Baz Castillo wrote:
> El Wednesday 05 September 2007 17:10:23 Daniel-Constantin Mierla escribió:
>   
>> your conditions are wrong. I said:
>> if ($var(is_uri_host_local)<0) to check if was a false response or:
>> if ($var(is_uri_host_local)>0) to check if was a true response.
>>
>> To clarify a bit:
>> - when a function or route returns, the code is interpreted as: negative
>> value is false; 0 is exit interpreting configuration file; positive is true
>> - when an integer value is tested, the test is as in C: 0 is false,
>> otherwise is true
>>
>> In your case, you test an integer.
>>     
>
>
> Ok, understood. And it works at you say (doing the test > or <).
>
> Anyway I don't like that test so I prefer to do at the start:
>
>   $var(is_uri_host_local)=is_uri_host_local();
>   if ($var(is_uri_host_local) != 1) {
>        $var(is_uri_host_local) = "";
>   }
>   
maybe not in this case, but yu should test for >0 to set it true or 
false. 1 is not the only return code representing true, any number which 
is positive.

Daniel

> And later do a "normal" test:
>
>   if ($var(is_uri_host_local)) ...
>   if (!$var(is_uri_host_local)) ...
>
> IMHO is clearer in this way, just my opinion.
>
>
> Thanks a lot for your good explanation and regards.
>
>
>   




More information about the Users mailing list