8000 [Console] fixed BC issue with static closures by araines · Pull Request #20847 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] fixed BC issue with static closures #20847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clarify fix
  • Loading branch information
Andy Raines committed Dec 13, 2016
commit a0d010825cc37ea078de946be9f0d5d86c30a9d2
11 changes: 9 additions & 2 deletions src/Symfony/Component/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,15 @@ public function setCode($code)
if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
$r = new \ReflectionFunction($code);
if (null === $r->getClosureThis()) {
// Cannot bind static closures for PHP<7.0 so it may fail
$code = @\Closure::bind($code, $this);
if (PHP_VERSION_ID < 70000) {
// Bug in PHP5: https://bugs.php.net/bug.php?id=64761
// This means that we cannot bind static closures and therefore we must
// ignore any errors here. There is no way to test if the closure is
// bindable.
$code = @\Closure::bind($code, $this);
} else {
$code = \Closure::bind($code, $this);
}
}
}

Expand Down
0