View Issue Details

IDProjectCategoryView StatusLast Update
0006288OXID eShop (all versions)1. ----- eShop frontend -----public2016-01-18 13:59
Reporters.krenz Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.9.6 / 5.2.6 
Fixed in Version4.9.7 / 5.2.7 
Summary0006288: [Smarty-Plugin][oxscript] An empty "include" or "add" parameter leads immediately output.
DescriptionIf the parameter "include" or "add" of the oxscript smarty plugin is empty, the "script" tags are rendered immediately. This can cause JavaScript errors.
Steps To ReproduceBased upon the Azure template, add the following Smarty code to a template:
--- CUT HERE ---
There shouldn't any script tag below
[{oxscript include="js/libs/cookie/jquery.cookie.js"}]
[{oxscript include=$oViewConf->getModuleUrl('IDonNot/Exist', 'out/src/js/non/existing/file.js')}]
There shouldn't any script tag above
--- CUT HERE ---

Expected result:
There shouldn't any script tag below
A warning appears.
There shouldn't any script tag above

Actual result:
There shouldn't any script tag below
<script type="text/javascript" src="http://example.com/out/azure/js/libs/cookie/jquery.cookie.js"></script>
There shouldn't any script tag above
Additional InformationI've created a Pull Request on GitHub: https://github.com/OXID-eSales/oxideshop_ce/pull/302
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

michael_keiluweit

2015-12-16 10:13

administrator   ~0011378

Last edited: 2015-12-16 10:13

Reporter is right.

The unwanted output is made because the smarty function makes a condition to see if the include tag was used:
} elseif ( !empty($params['include']) ) {


but because the function \oxViewConfig::getModulePath returns an empty string if the file was not found, the condition from above fails and the smarty function jumps into the last condition:
} elseif ( !$sWidget || $blInWidget || $blAjaxRequest ) {


which actually appends the content of the script to the variable $sOutput. That's the reason why the smarty tag is printed, before it should.

anton.fedurtsya

2016-01-18 12:08

administrator   ~0011439

Fixed with pull request: https://github.com/OXID-eSales/oxideshop_ce/pull/302