View Issue Details

IDProjectCategoryView StatusLast Update
0007640module Visual CMSmodule Visual CMS - subpublic2024-12-10 11:43
ReporterSimonGassenschmidt Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version3.6.2 
Summary0007640: Module extending smarty-block visualcms_shortcodes_options breaks since 3.6.2
DescriptionSince update to 3.6.2 a module overriding and loading parent with [{$smarty.block.parent}] breaks in line of $__label|addslashes|replace:'\\\'':'\''|oxescape where it cannot finde __label with such error message:

[uncaught error] [type E_USER_ERROR] [file [...]/vendor/smarty/smarty/libs/Smarty.class.php] [line 1099] [code ] [message Smarty error: [in ddoevisualcmsadmin.tpl line 140]: syntax error: unrecognized tag: $__label|addslashes|replace:'\\'':'\''|oxescape (Smarty_Compiler.class.php, line 440)]

This error with the same module doesn't occur in 3.6.1.

This error is only triggerd, if you use [{$smarty.block.parent}]
Steps To ReproduceInstall 6.5.4
Install Visual CMS with Version 3.6.2 with composer require ddoe/visualcms-module:"3.6.2 as 3.6.1"
Install smartytest modul, see attached

Try to access Visual CMS
TagsNo tags attached.
Attached Files
smartytest(1).zip (1,479 bytes)

Activities

mf

2024-04-24 14:02

manager   ~0016803

The cause lies in the inheritance by [{$smarty.block.parent}]. The quotation marks of "replace" are converted into HTML entities. As a result, "replace" no longer works and the $_label variable becomes invalid, which leads to an error.

A simple workaround to avoid this would be to write a new Smarty plugin:

As a module:
https://docs.oxid-esales.com/developer/en/6.5/development/modules_components_themes/module/skeleton/metadataphp/amodule/smartyPluginDirectories.html

For testing:
vendor/oxid-esales/oxideshop-ce/source/Core/Smarty/Plugin/modifier.vcmscategoriesescape.php

With the content:
function smarty_modifier_vcmscategoriesescape($sString)
{
    $sString = str_replace('\\\'', '\'', $sString);
    return $sString;
}

And replace the lines 138 and 142 in ddoevisualcmsadmin.tpl:
[{$_label|addslashes|replace:'\\\'':'\''|oxescape}]
with
[{$_label|addslashes|vcmscategoriesescape|oxescape}]

SvenBrunk

2024-12-10 11:43

manager   ~0017765

Smarty is no longer supported