Null string: STRING="" vs STRING=

I’ve seen code generated by FreePBX which initializes null string as:
STRING="“
However it is not null string, it has two characters (two double quotes). Later this STRING is tested to see if it’s null like this:
IF($[”${STRING}"=""]?A:B)
which generates syntax error, and neither A nor B is returned. I also found in FreePBX code a funny trick, which works with really null string, and with “” string:
IF($[“foo${STRING}”=“foo”]?A:B)
even though it generates syntax error, proper value is returned. More tests:

exten => dlocal,1,Set(TEST="")
exten => dlocal,n,Set(TEST1=${IF($["${TEST}"=""]?TRUE1:FALSE1)})
exten => dlocal,n,Set(TEST2=${IF($["foo${TEST}"="foo"]?TRUE2:FALSE2)})
exten => dlocal,n,Set(TEST3=${IF($["${TEST}foo"="foo"]?TRUE3:FALSE3)})
exten => dlocal,n,Set(TEST4=${IF($[${TEST}=""]?TRUE4:FALSE4)})
exten => dlocal,n,Set(TEST=)
exten => dlocal,n,Set(TEST5=${IF($[${TEST}=""]?TRUE5:FALSE5)})

Result in logs:

[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:1] Set("SIP/586006161-00000032", "TEST=""") in new stack
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '<token>', expecting $end; Input:
""""=""
  ^
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[May 19 22:08:11] WARNING[18877] func_logic.c: Syntax IF(<expr>?[<true>][:<false>])  (expr must be non-null, and either <true> or <false> must be non-null)
[May 19 22:08:11] WARNING[18877] func_logic.c:       In this case, <expr>='', <true>='TRUE1', and <false>='FALSE1'
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:2] Set("SIP/586006161-00000032", "TEST1=") in new stack
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '<token>', expecting $end; Input:
"foo"""="foo"
     ^
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:3] Set("SIP/586006161-00000032", "TEST2=TRUE2") in new stack
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '<token>', expecting $end; Input:
"""foo"="foo"
  ^
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[May 19 22:08:11] WARNING[18877] func_logic.c: Syntax IF(<expr>?[<true>][:<false>])  (expr must be non-null, and either <true> or <false> must be non-null)
[May 19 22:08:11] WARNING[18877] func_logic.c:       In this case, <expr>='', <true>='TRUE3', and <false>='FALSE3'
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:4] Set("SIP/586006161-00000032", "TEST3=") in new stack
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:5] Set("SIP/586006161-00000032", "TEST4=TRUE4") in new stack
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:6] Set("SIP/586006161-00000032", "TEST=") in new stack
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '=', expecting $end; Input:
=""
^
[May 19 22:08:11] WARNING[18877] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[May 19 22:08:11] WARNING[18877] func_logic.c: Syntax IF(<expr>?[<true>][:<false>])  (expr must be non-null, and either <true> or <false> must be non-null)
[May 19 22:08:11] WARNING[18877] func_logic.c:       In this case, <expr>='', <true>='TRUE5', and <false>='FALSE5'
[May 19 22:08:11] VERBOSE[18877] pbx.c:     -- Executing [dlocal@macro-dial-one:7] Set("SIP/586006161-00000032", "TEST5=") in new stack

Asterisk version: 1.8.4

Why would anyone use STRING=""? Maybe in earlier versions of Asterisk it was a null string?

Related bug report: http://www.freepbx.org/v2/ticket/5159

I thought I had the same problem but turns out something else is going on (possibly related). Since upgrading to Ast 1.8.4 call forwarding fails with this error.

[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [s@macro-dial-one:26] GosubIf(“SIP/xx.xx.xx.xx-000003ba”, “0?dstring,1:dlocal,1”) in new stack
[2011-06-15 14:09:55] WARNING[3213] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected ‘’, expecting $end; Input:
""""=""
^
[2011-06-15 14:09:55] WARNING[3213] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[2011-06-15 14:09:55] WARNING[3213] func_logic.c: Syntax IF(?[][:]) (expr must be non-null, and either or must be non-null)
[2011-06-15 14:09:55] WARNING[3213] func_logic.c: In this case, =’’, =‘224168480139’, and =‘Local/224168480139@from-internal/n’
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [dlocal@macro-dial-one:1] Set(“SIP/xx.xx.xx.xx-000003ba”, “DSTRING=”) in new stack
[2011-06-15 14:09:55] WARNING[3213] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected ‘’, expecting $end; Input:
""""=""
^
[2011-06-15 14:09:55] WARNING[3213] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[2011-06-15 14:09:55] WARNING[3213] func_logic.c: Syntax IF(?[][:]) (expr must be non-null, and either or must be non-null)
[2011-06-15 14:09:55] WARNING[3213] func_logic.c: In this case, =’’, =‘1’, and =‘0’
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [dlocal@macro-dial-one:2] Set(“SIP/xx.xx.xx.xx-000003ba”, “USEGOTO=”) in new stack
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [dlocal@macro-dial-one:3] Return(“SIP/xx.xx.xx.xx-000003ba”, “”) in new stack
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [s@macro-dial-one:27] GotoIf(“SIP/xx.xx.xx.xx-000003ba”, “1?nodial”) in new stack
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Goto (macro-dial-one,s,46)
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [s@macro-dial-one:46] ExecIf(“SIP/xx.xx.xx.xx-000003ba”, “1?Set(DIALSTATUS=NOANSWER)”) in new stack
[2011-06-15 14:09:55] VERBOSE[3213] pbx.c: – Executing [s@macro-dial-one:47] NoOp(“SIP/xx.xx.xx.xx-000003ba”, “Returned from dial-one with nothing to call and DIALSTATUS: NOANSWER”) in new stack