Skip to content

Commit 96b0417

Browse files
Avoid calculating the path_hint more then once per field. Fixes infinite loop when MultiSafepay module is installed.
1 parent dfdace2 commit 96b0417

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Plugin/ConfigFieldPlugin.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class ConfigFieldPlugin
3939
*/
4040
private $request;
4141

42+
/**
43+
* @var array<string>
44+
*/
45+
private $handledFields = [];
46+
4247
public function __construct(
4348
Escaper $escaper,
4449
ScopeConfigInterface $scopeConfig,
@@ -98,7 +103,15 @@ public function afterGetData(
98103
return $result;
99104
}
100105

101-
$result['path_hint'] = '<small>' . __('Path: <code>%1</code>', $this->getPath($subject) . '</small>');
106+
// make sure we only calculate the path hint once
107+
// there is a known issue with a plugin from the MultiSafepay module (FieldPlugin) that can cause an infinite loop
108+
// this solves it by calculating the field's object hash and making sure we only call getPath once per Field
109+
$fieldObjectHash = spl_object_hash($subject);
110+
if (!in_array($fieldObjectHash, $this->handledFields, true)) {
111+
$this->handledFields[] = $fieldObjectHash;
112+
113+
$result['path_hint'] = '<small>' . __('Path: <code>%1</code>', $this->getPath($subject) . '</small>');
114+
}
102115

103116
return $result;
104117
}

0 commit comments

Comments
 (0)