You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/OptionsResolver.php
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -860,8 +860,20 @@ public function offsetGet($option)
860
860
if (isset($this->deprecated[$option])) {
861
861
$deprecationMessage = $this->deprecated[$option];
862
862
863
-
if ($deprecationMessageinstanceof \Closure && !\is_string($deprecationMessage = $deprecationMessage($value))) {
864
-
thrownewInvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", returns an empty string to ignore.', \gettype($deprecationMessage)));
863
+
if ($deprecationMessageinstanceof \Closure) {
864
+
// If the closure is already being called, we have a cyclic dependency
865
+
if (isset($this->calling[$option])) {
866
+
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling))));
867
+
}
868
+
869
+
$this->calling[$option] = true;
870
+
try {
871
+
if (!\is_string($deprecationMessage = $deprecationMessage($this, $value))) {
872
+
thrownewInvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", returns an empty string to ignore.', \gettype($deprecationMessage)));
0 commit comments