View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0006288 | OXID eShop (all versions) | 1. ----- eShop frontend ----- | public | 2015-12-15 13:07 | 2016-01-18 13:59 | 
| Reporter | s.krenz | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always | 
| Status | resolved | Resolution | fixed | ||
| Product Version | 4.9.6 / 5.2.6 | ||||
| Fixed in Version | 4.9.7 / 5.2.7 | ||||
| Summary | 0006288: [Smarty-Plugin][oxscript] An empty "include" or "add" parameter leads immediately output. | ||||
| Description | If 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 Reproduce | Based 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 Information | I've created a Pull Request on GitHub: https://github.com/OXID-eSales/oxideshop_ce/pull/302 | ||||
| Tags | No tags attached. | ||||
| Theme | Not defined | ||||
| Browser | Not defined | ||||
| PHP Version | Not defined | ||||
| Database Version | Not defined | ||||
|  | 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. | 
|  | Fixed with pull request: https://github.com/OXID-eSales/oxideshop_ce/pull/302 | 
