[Home]

Summary:ASTERISK-07277: AEL2 not properly escaping commas
Reporter:Sherwood McGowan (rushowr)Labels:
Date Opened:2006-07-04 00:57:17Date Closed:2006-07-06 18:10:33
Priority:MajorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_ael
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When using the MYSQL addon in asterisk, I must escape many characters, including the comma (,) or the query won't be passed correctly. I set the querystring in the variable QUERYSTRING and then run the query. Unfortunately, the AEL parser does not recognize the escape character before the comma, and my resulting queries have | in place of commas.

This QUERYSTRING, as set by the command below:
Set(QUERYSTRING=SELECT\ foo\,\ bar\ FROM\ foobar)
Gets sent to the MYSQL command as:
SELECT foo| bar FROM foobar

If need be I can show realworld examples as well.
Comments:By: Sherwood McGowan (rushowr) 2006-07-04 01:00:08

sorry mates, accidentally submitted in wrong cat. Can it be moved?

By: Serge Vecher (serge-v) 2006-07-05 10:23:23

murf: can you please help with this one?

By: Steve Murphy (murf) 2006-07-05 10:38:31

Hello-- yes, I'm assigned to this bug. Very interesting. I'll look into it!

By: Sherwood McGowan (rushowr) 2006-07-05 10:46:39

Hey quick update Murf. When using the AEL format of just "declaring" the variable, I can assign the value per the "old" way if I quote the value. For example, both of the following blocks output the same result (SELECT foo, bar, FROM foobar):

[querytest]
exten = s,1,Set(query=SELECT\ foo\,\ bar\ FROM\ foobar)
exten = s,n,Verbose(2|${query})

and

context querytest {
 s => {
   query="SELECT\ foo\,\ bar\ FROM\ foobar" ;
   Verbose(2|${query}) ;
 }
}

By: Steve Murphy (murf) 2006-07-06 18:02:11

Confirmed this bug.

By: Steve Murphy (murf) 2006-07-06 18:05:32

I was able to replicate the bug, and tracked it down to the lex rule that found a comma in the func args. I modified the rule to exclude commas with leading backslashes. This fix appears to work. added regression test, committed the new stuff to trunk.

If there are further problems, feel free to reopen, or file a new bug report as is appropriate. Many thanks for your help in reporting this!