[Devel] do_assign: no value in right expression

Juha Heinanen jh at tutpro.com
Tue Jun 12 08:27:15 CEST 2007


Daniel-Constantin Mierla writes:

 > assuming NULL value can producing unexpecting results. For example, 
 > assigning null to an avp will delete first avp with that name. It might 
 > not be what exactly someone expects from such operation -- instead of 
 > getting a new avp, you get deleted an existing one.

daniel,

thanks for the explanation.  so what is the conclusion?

in my opinion, the script should be readable, i.e., the behavior should
be the same as what the code looks like.

my suggestion is to implement the same behavior what php has, i.e., code

#!/usr/bin/php5
<?

$a = $b;

if ($a === null) print "true\n";

?>

prints "true" without any error messages.

thus a value of a non-existing avp or a script variable to which no
value has been assigned would be null, which is not same as 0.

-- juha



More information about the Devel mailing list