View Issue Details

IDProjectCategoryView StatusLast Update
0006264OXID eShop (all versions)2.2. Shop settingspublic2015-11-17 09:58
Reportermario_lorenz Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version4.9.6 / 5.2.6 
Summary0006264: oxconfig->_setConfVarFromDb - kein htmlentities bei Vartype "str", "select", "num", "int"
Descriptioncompare oxconfig->setConfVarFromDb and shop_config->_unserializeConfVar

In shop_config_unserializeConfVar you see, that Vartypes "str", "select", "num", "int" are converted with htmlentities. In the oxconfig->setConfVarFromDb are not.

When you have a Quote in your Variable, and you want to get it via oxconfig->getConfigParam(...), then the Quote isnt there.
Steps To ReproduceMaybe in any Admin-Controller, you save in the save-Method a Variable:

$sVar = '"';
$oConfig->saveShopConfVar('str', 'varQuote', $sVar, null, 'module:xyz');

The same Admin-Controller has a method for template-access to config:

public function getConfigParam($sVar)
{
  return oxRegistry::getConfig()->getConfigParam($sVar);
}

In Admin-Template:

<input type="text" value="[{$oView->getConfigParam('varQuote')}]">

You´ll see that the quote is not set.
Additional InformationThe solution is to add the htmlentities in oxconfig (Line 605-607, Oxid 4.9.6)

 default:
   $this->setConfigParam($sVarName, htmlentities($sVarVal));
   break;
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

michael_keiluweit

2015-11-17 09:24

administrator   ~0011306

The shop doesn't provide a method to access config variables directly in templates, that would be against the philosophy.
If there's a need to have a config value in a template, a getter must be created.

In the given case you could use the Smarty function "escape":
<input type="text" value="[{$oView->getConfigParam('sVarQuote')|escape}]">

Or you adapt your written getter to escape strings.

QA

2015-11-17 09:57

administrator   ~0011307

The main method to store variables in the table oxconfig is the method oxConfig::saveShopConfVar. If the value needs some special treatment it's not the job of the config object to manipulate it. This must be made by the active controller.

Shop_Config::_unserializeConfVar is just a helper method for the Shop_Config object and not a general method to store config values.