harrydeluxe / php-liquid

A PHP port of Ruby's Liquid Templates
http://www.delacap.com/artikel/Liquid-Templates/
MIT License
239 stars 119 forks source link

Colon not allowed in date format string? #64

Open sml1990 opened 4 years ago

sml1990 commented 4 years ago

Hello,

It seems as though {{ "now" | date: "%Y-%m-%d %H:%M" }} renders null but {{ "now" | date: "%Y-%m-%d %H%M" }} renders just fine. Is anyone else having this issue? It seems that the colon is causing it to render null.

sml1990 commented 4 years ago

It seems that if you change the following within /src/Liquid.php, it fixes the problem.

Change: 'QUOTED_STRING_FILTER_ARGUMENT' => '"[^":]"|\'[^\':]\'',

To: 'QUOTED_STRING_FILTER_ARGUMENT' => '"[^"]"|\'[^\']\'',

Does anyone know the details of the original pattern and why it was used? While this seems to have solved the colon issue, I haven't yet done enough testing to see if the new pattern causes other problems.