Skip to content

Commit 3e149f6

Browse files
author
OlgaVasyltsun
committed
MC-33922: Improve email templates
1 parent 29a9f6a commit 3e149f6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

lib/internal/Magento/Framework/Filter/VariableResolver/LegacyResolver.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,32 @@ private function handleObjectMethod(Template $filter, array $templateVariables,
160160
{
161161
$object = $stackArgs[$i - 1]['variable'];
162162
$method = $stackArgs[$i]['name'];
163-
if (method_exists($object, $method) && substr($method, 0, 3) !== 'set') {
163+
if ($this->isMethodCallable($object, $method)) {
164164
$args = $this->getStackArgs($stackArgs[$i]['args'], $filter, $templateVariables);
165165
$stackArgs[$i]['variable'] = call_user_func_array([$object, $method], $args);
166166
}
167167
}
168168

169+
/**
170+
* Check if object method can be called.
171+
*
172+
* @param mixed $object
173+
* @param string $method
174+
* @return bool
175+
*/
176+
private function isMethodCallable($object, string $method): bool
177+
{
178+
if (
179+
method_exists($object, $method)
180+
&& substr($method, 0, 3) !== 'set'
181+
&& $method !== '___callParent'
182+
) {
183+
return true;
184+
}
185+
186+
return false;
187+
}
188+
169189
/**
170190
* Return if the given index should be processed for data access
171191
*

0 commit comments

Comments
 (0)