Hi,
On 04/24/2009 06:44 PM, Juha Heinanen wrote:
Miklos Tirpak writes:
Both of them would return false. Btw, I do not
think that empty value is
allowed for to tag, it's a very rare case, and could be covered with
some explicit check.
to me to tag was just an example of some variable.
We used to write this, but had lots of issues.
The problem happens for
example with @contact.uri.user, when there is no contact header.
Unfortunately the select function can return and error instead of
success with "" value in this case. (The can be also revisited) And 'if
(@contact.uri.user == "")' would evaluate to false because the left had
side value does not exist, which is wrong.
this is exactly my point. you have to first check if something exists
before you start to compare its value to something.
Yes, this could work, but than we need two checks in most of the cases:
if (defined($v) && ($v != "")) {...}
This is more precise indeed, but the script writer should not forget the
extra checks.
Regarding SER selects, if we go for this solution, I think we should
revisit all the select functions. For example @foo.param.abcd should
return "" only if the 'abcd' parameter of header 'foo' exists,
but it's
value is empty. Than we could simply check the existence of the parameter:
if (defined((a)foo.param.abcd)) {...}
Miklos
-- juha