diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-14 15:07:30 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-14 15:07:30 +0000 |
commit | 3c9cd5c5b5e8df8123b759b50b5a0c7aeda1d584 (patch) | |
tree | 9494dcafbd323872351f8a689521ca4a78548ddf /main | |
parent | b43ac58b68a726ce60e81be832e4260258586440 (diff) |
Print out a warning when spaces are used in the variable name in Set and MSet. It is extremely hard to debug this issue so this should make it easier.
(closes issue #11759)
Reported by: caio1982
Patches:
setvar_space_warning1.diff uploaded by caio1982 (license 22)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@98714 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/pbx.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/pbx.c b/main/pbx.c index 0c0be0b93..3820c4615 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -7298,6 +7298,8 @@ int pbx_builtin_setvar(struct ast_channel *chan, void *data) mydata = ast_strdupa(data); name = strsep(&mydata, "="); value = mydata; + if (strchr(name, ' ')) + ast_log(LOG_WARNING, "Please avoid unnecessary spaces on variables as it may lead to unexpected results ('%s' set to '%s').\n", name, mydata); pbx_builtin_setvar_helper(chan, name, value); return(0); @@ -7325,10 +7327,13 @@ static int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata) for (x = 0; x < args.argc; x++) { AST_NONSTANDARD_APP_ARGS(pair, args.pair[x], '='); - if (pair.argc == 2) + if (pair.argc == 2) { pbx_builtin_setvar_helper(chan, pair.name, pair.value); - else + if (strchr(pair.name, ' ')) + ast_log(LOG_WARNING, "Please avoid unnecessary spaces on variables as it may lead to unexpected results ('%s' set to '%s').\n", pair.name, pair.value); + } else { ast_log(LOG_WARNING, "MSet: ignoring entry '%s' with no '=' (in %s@%s:%d\n", pair.name, chan->exten, chan->context, chan->priority); + } } return 0; |