From 00199f318ecab58921c0eebfd6ba32dce208297c Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 21 Jan 2018 14:01:14 +0100 Subject: [PATCH 1/3] Make sure pop() is called when Callback errors in on(...) function --- src/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/functions.php b/src/functions.php index 85e20b34f..376dea035 100644 --- a/src/functions.php +++ b/src/functions.php @@ -372,9 +372,12 @@ function on($hosts, callable $callback) foreach ($hosts as $host) { if ($host instanceof Host) { - Context::push(new Context($host, $input, $output)); - $callback($host); - Context::pop(); + try { + Context::push(new Context($host, $input, $output)); + $callback($host); + } finally { + Context::pop(); + } } else { throw new \InvalidArgumentException("Function on can iterate only on Host instances."); } From 8e1017101f215c1f113776a13202a33d9efe007b Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 21 Jan 2018 14:03:43 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bc0df87c..d1f076bcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - fix within() to also restore the working-path when the given callback throws a Exception [#1463] - `pcntl_fork` is blacklisted per default on ubuntu lts boxes. make sure deployer doesnt emit a warning in this case [#1476] - Update silverstripe recipe to support silverstripe 4 +- Make sure pop() is called when Callback errors in on(...) function [#1513] ## v6.0.5 [v6.0.4...v6.0.5](https://github.com/deployphp/deployer/compare/v6.0.4...v6.0.5) @@ -344,6 +345,7 @@ - Fixed typo3 recipe - Fixed remove of shared dir on first deploy +[#1513]: https://github.com/deployphp/deployer/pull/1513 [#1481]: https://github.com/deployphp/deployer/issues/1481 [#1476]: https://github.com/deployphp/deployer/pull/1476 [#1472]: https://github.com/deployphp/deployer/pull/1472 From 64cdd13e0b9b5c9d0d5360b91a176d8433a27cdd Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 21 Jan 2018 14:07:40 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f076bcb..29835188d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ - fix within() to also restore the working-path when the given callback throws a Exception [#1463] - `pcntl_fork` is blacklisted per default on ubuntu lts boxes. make sure deployer doesnt emit a warning in this case [#1476] - Update silverstripe recipe to support silverstripe 4 -- Make sure pop() is called when Callback errors in on(...) function [#1513] +- Make sure Context::pop() is called when Callback errors in on(...) function [#1513] ## v6.0.5 [v6.0.4...v6.0.5](https://github.com/deployphp/deployer/compare/v6.0.4...v6.0.5)