From f5ea36bb4d44e8b74b00653a635de01039876427 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= <gabor@hojtsy.hu>
Date: Wed, 11 Jul 2007 22:04:57 +0000
Subject: [PATCH] #125533 by keve: do not continue bootstrap if the process was
 called back with a phase already executed

---
 includes/bootstrap.inc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index e1b28aca7d9d..6683371cdeb1 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -852,6 +852,11 @@ function drupal_anonymous_user($session = '') {
 function drupal_bootstrap($phase) {
   static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL);
 
+  // Stop early if $phase was already executed.
+  if (!in_array($phase, $phases)) {
+    return;
+  }
+
   while (!is_null($current_phase = array_shift($phases))) {
     _drupal_bootstrap($current_phase);
     if ($phase == $current_phase) {
-- 
GitLab