Skip to content

Commit

Permalink
Merge branch '9.x' into 10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Jan 10, 2023
2 parents 0618197 + 62d43e0 commit 2292554
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,25 @@ public function wrap(Closure $callback, array $parameters = [])
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
$pushedToBuildStack = false;

if (is_array($callback) && ! in_array(
$className = (is_string($callback[0]) ? $callback[0] : get_class($callback[0])),
$this->buildStack,
true
)) {
$this->buildStack[] = $className;

$pushedToBuildStack = true;
}

$result = BoundMethod::call($this, $callback, $parameters, $defaultMethod);

if ($pushedToBuildStack) {
array_pop($this->buildStack);
}

return $result;
}

/**
Expand Down

0 comments on commit 2292554

Please sign in to comment.