[sr-dev] Assigning a null value from a $sht to a $var fails

Hugh Waite hugh.waite at crocodile-rcs.com
Wed Nov 27 10:48:19 CET 2013


After reading the existing issue FS#141, I think our code was incorrect 
but producing the right results!
Previous to Daniel/Victor's change, the test for 0 == $null was true, so 
our htable cache was not working for values of 0 - it was doing a DB 
lookup every time. After the fix, this test failed so the lookups never 
happened.

Can we revisit this issue 
(http://sip-router.org/tracker/index.php?do=details&task_id=141)? Is 
there any reason that you shouldn't be able to assign a value of $null 
to a script variable?

Hugh

On 25/11/2013 12:51, Hugh Waite wrote:
> Hello,
> We are having an issue with PVs after upgrading to the latest master 
> (i.e. 4.1.0-pre1) which might be related to the comparison of $null and 0
> In our previous version (compiled on 9th October) the following code 
> worked. It is using the htable as a DB cache
>
> $var(ip_trusted) = $sht(trusted=>$var(srcip));
> if($var(ip_trusted) == $null) {
>   /* DB lookup */
>   $sht(trusted->$var(srcip)) = $var(ip_trusted);
> }
>
> After upgrading, the first line is not working as expected. The htable 
> value is null (not assigned), but the $var(ip_trusted) value is 
> assigned the value 0, so the check fails.
>
> Is this related to the pv comparison bugfix 
> (http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commitdiff;h=3856e9e81c8410b220b893a0dfe7114bba6bdc0d)?
>
> Certainly something has changed since 9 Oct.
>
> Hugh
>


-- 
Hugh Waite
Principal Design Engineer
Crocodile RCS Ltd.




More information about the sr-dev mailing list