feulf / raintpl

Easy Php Template Engine
https://feulf.github.io/raintpl
188 stars 47 forks source link

Incorrect parsing of strings containing multiple dots '.' assigned in template #30

Open brokencube opened 11 years ago

brokencube commented 11 years ago

If a string is assigned to a variable in a template and contains multiple dot characters, the parser will assume that we are trying to reference an array for all but the last dot, even without a dollar sign.

Example:

{$temp1='first.second'}
{$temp2='first.second.third'}
{$temp3='first.second.third.fourth'}
{$temp1}
{$temp2}
{$temp3}

Expected output:

first.second
first.second.third
first.second.third.fourth

Actual output:

first.second
first["second"].third
first["second"]["third"].fourth

Tested using current master (dev-master 82da191)

feulf commented 11 years ago

I'll check this issue later today, thanks for reporting it!