Skip to content

Commit 7beaea2

Browse files
committed
MAGETWO-98155: Fixed incorrect email template rendering
1 parent 0965809 commit 7beaea2

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

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

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ class Template implements \Zend_Filter_Interface
6060
* @var string[]
6161
*/
6262
private $restrictedMethods = [
63-
'addafterfiltercallback',
6463
'getresourcecollection',
6564
'load',
6665
'save',
6766
'getcollection',
6867
'getresource',
6968
'getconfig',
69+
'delete',
7070
];
7171

7272
/**
@@ -314,25 +314,6 @@ protected function getParameters($value)
314314
return $params;
315315
}
316316

317-
/**
318-
* Validate method call initiated in a template.
319-
*
320-
* Deny calls for methods that may disrupt template processing.
321-
*
322-
* @param object $object
323-
* @param string $method
324-
* @return void
325-
* @throws \InvalidArgumentException
326-
*/
327-
private function validateVariableMethodCall($object, $method)
328-
{
329-
if ($object === $this) {
330-
if (in_array(mb_strtolower($method), $this->restrictedMethods)) {
331-
throw new \InvalidArgumentException("Method $method cannot be called from template.");
332-
}
333-
}
334-
}
335-
336317
/**
337318
* Check allowed methods for data objects.
338319
*
@@ -402,19 +383,6 @@ protected function getVariable($value, $default = '{no_value_defined}')
402383
}
403384
}
404385
$last = $i;
405-
} elseif (isset($stackVars[$i - 1]['variable'])
406-
&& is_object($stackVars[$i - 1]['variable'])
407-
&& $stackVars[$i]['type'] == 'method'
408-
) {
409-
// Calling object methods
410-
$object = $stackVars[$i - 1]['variable'];
411-
$method = $stackVars[$i]['name'];
412-
if (method_exists($object, $method)) {
413-
$args = $this->getStackArgs($stackVars[$i]['args']);
414-
$this->validateVariableMethodCall($object, $method);
415-
$stackVars[$i]['variable'] = call_user_func_array([$object, $method], $args);
416-
}
417-
$last = $i;
418386
}
419387
}
420388

lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ public function disallowedMethods()
230230
['getCollection'],
231231
['getResource'],
232232
['getConfig'],
233+
['delete'],
233234
];
234235
}
235236
}

0 commit comments

Comments
 (0)