summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2018-10-20 07:14:35 (GMT)
committerxjm2018-10-20 07:16:23 (GMT)
commit29aaab08b6cbeed87d18d342b905640f30e0e59b (patch)
treef93463e807bd182ef2d4bd7c077a872af51c7638
parentc70cc7ee407301e4951244a828127ea3f9940b47 (diff)
Issue #2575105 by alexpott: hotfix for PHP 5 test failures in ShutdownFunctionsTestHEAD8.6.x
(cherry picked from commit 8861a546b8ca766fff447081e90c9a67a4a822f4)
-rw-r--r--core/includes/bootstrap.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 45c9490..ebcd217 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1033,8 +1033,12 @@ function _drupal_shutdown_function() {
chdir(DRUPAL_ROOT);
try {
- foreach ($callbacks as &$callback) {
+ reset($callbacks);
+ // Do not use foreach() here because it is possible that the callback will
+ // add to the $callbacks array via drupal_register_shutdown_function().
+ while ($callback = current($callbacks)) {
call_user_func_array($callback['callback'], $callback['arguments']);
+ next($callbacks);
}
}
// PHP 7 introduces Throwable, which covers both Error and