[Home]

Summary:ASTERISK-14015: FIELDQTY not function correctly with escape characters from variables.
Reporter:Bryant Zimmerman (zktech)Labels:
Date Opened:2009-04-25 09:30:11Date Closed:2011-06-07 14:01:03
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I am using the FIELDQTY to dynamically parse headers and other strings. When I pass in the delimeter in a variable it does not work correctly if the variable has a escape character in it..

Example 1: ARG1 = header;data;data ARG2=\;
exten => s,n,Set(l_cnt=${FIELDQTY(ARG1,ARG2)})

This should and did in version 1.4 return 3 to l_cnt
In 1.6 it returns 1 to l_cnt

Example 2: ARG1 = header;data;data
exten => s,n,Set(l_cnt=${FIELDQTY(ARG1,\;)})

This returns 3 to l_cnt as expected. This is very broken as I can not now send values with escape charcters to this function.

Does this bug also effect any other functions that use to allow escape characters coming in variables?

Any help is apperciated.
Thanks
Bryant


****** ADDITIONAL INFORMATION ******

I am actually using 1.6.0.9 but this does occur in all the version from 1.6.0.3 on I have not tested with 1.6.0.x prior to the 1.6.0.3 release
Comments:By: Tilghman Lesher (tilghman) 2009-04-26 00:43:53

Try, instead, exten => s,n,Set(l_cnt=${FIELDQTY(ARG1,${ARG2})}).  Not sure why this would have worked in 1.4, but the delimiter is never supposed to be the NAME of a variable, only the value itself.  Only the field (first argument) takes the name, as opposed to the value.

By: Bryant Zimmerman (zktech) 2009-04-27 09:25:35

Thank you for the directions. It does appear that you are correct that the second argument must be in the curl braces. This was not the case in 1.4 based on our current code base. I am updating our code base to this format. I have found this to be very confusing. Is this the case as well for the CUT function. I was using the same format there in 1.4 where I was just using the var names and not the curl braces.

Thank you Very much
Bryant

By: Tilghman Lesher (tilghman) 2009-04-28 10:04:55

The only thing I can think of is that someone patched your 1.4 codebase to do that.  The 1.4 codebase in our repository does not work that way.