Skip to content

Commit e712388

Browse files
committed
AC-9831: Block template render enhancement
* code review fix
1 parent 600b74d commit e712388

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

lib/internal/Magento/Framework/Filter/Template.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,6 @@ protected function getParameters($value)
514514
$tokenizer->setString($value);
515515
$params = $tokenizer->tokenize();
516516
foreach ($params as $key => $value) {
517-
$validKey = strtolower($key);
518-
if (strcmp($key, $validKey)) {
519-
$params[$validKey] = $value;
520-
unset($params[$key]);
521-
}
522517
if ($value !== null && substr($value, 0, 1) === '$') {
523518
$params[$key] = $this->getVariable(substr($value, 1), null);
524519
}

lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function tokenize()
2525
}
2626

2727
if ($this->char() !== '=') {
28-
$parameterName .= $this->char();
28+
$parameterName .= strtolower($this->char());
2929
} else {
3030
$parameters[$parameterName] = $this->getValue();
3131
$parameterName = '';

lib/internal/Magento/Framework/View/Element/AbstractBlock.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,18 @@ public function getCacheKeyInfo()
10431043
* Get Key for caching block content
10441044
*
10451045
* @return string
1046+
* @throws \Magento\Framework\Exception\LocalizedException
10461047
*/
10471048
public function getCacheKey()
10481049
{
10491050
if ($this->hasData('cache_key')) {
1051+
if (preg_match('/[^a-z0-9]/i', $this->getData('cache_key'))) {
1052+
throw new \Magento\Framework\Exception\LocalizedException(
1053+
__(
1054+
'Please enter cache key with only alphanumeric characters.'
1055+
)
1056+
);
1057+
}
10501058
return static::CUSTOM_CACHE_KEY_PREFIX . $this->getData('cache_key');
10511059
}
10521060

0 commit comments

Comments
 (0)