CustomVariable: fix rendering for keys starting...

...with numbers

fixes #792
This commit is contained in:
Thomas Gelf 2017-02-15 12:50:27 +01:00
parent 2bc477daaa
commit 25395656ce
1 changed files with 1 additions and 1 deletions

View File

@ -115,7 +115,7 @@ abstract class CustomVariable implements IcingaConfigRenderer
protected function renderKeyName($key)
{
if (preg_match('/^[a-z0-9_]+\d*$/i', $key)) {
if (preg_match('/^[a-z][a-z0-9_]*$/i', $key)) {
return 'vars.' . c::escapeIfReserved($key);
} else {
return 'vars[' . c::renderString($key) . ']';