php-liquid
php-liquid copied to clipboard
Illegal template name
Given the template name page.contact
, it will fail if the extensions are set to false.
Maybe it should check if the value after the .
is the value of the include suffix?
Or what does it matter if it matches page.contact.liquid
or page.contact
?
\Liquid\Liquid::set('INCLUDE_SUFFIX', 'liquid');
\Liquid\Liquid::set('INCLUDE_PREFIX', '');
\Liquid\Liquid::set('INCLUDE_ALLOW_EXT', false);
\Liquid\Liquid::set('ESCAPE_BY_DEFAULT', false);
$template_file = 'page.contact'
$liquid->parseFile ($template_file);
FileSystem/local.php
$nameRegex = Liquid::get('INCLUDE_ALLOW_EXT')
? new Regexp('/^[^.\/][a-zA-Z0-9_\.\/-]+$/')
: new Regexp('/^[^.\/][a-zA-Z0-9_\/-]+$/');
if (!$nameRegex->match($templatePath)) {
throw new ParseException("Illegal template name '$templatePath'");
}