I've registered an own resource type which was then set as standard by changing
default_resource_type. When I however fetch a template with 'file:' prefix that
extends another template without prefix, my resource handling gets corrupt.
The problem is in Smarty_Internal_Compile_Private_Child_Block::compile(). From
the second line following:
// update template with original template resource of {block}
if (trim($_attr['type'], "'") == 'file') {
$compiler->template->template_resource = realpath(trim($_attr['file'], "'"));
} else {
$compiler->template->template_resource = trim($_attr['resource'], "'");
}
But the problem is that realpath trims the 'file:' prefix that is given in
$_attr['file']. This does not cause problems when default_resource_type is set
to 'file', but does when it differs. This means that the template then has a
wrong resource type, which will eventually lead to problems in any custom
resource handler.
The fix is very simple:
$compiler->template->template_resource = 'file:' . realpath(trim($_attr['file'], "'"));
You might only want to add the prefix if default_resource_type is not 'file',
but the above way should not cause problems.
Original issue reported on code.google.com by bde...@gmail.com on 23 Sep 2014 at 1:14
Original issue reported on code.google.com by
bde...@gmail.com
on 23 Sep 2014 at 1:14