From 0395715348de9cfddcd3d7666479ee0fcb554357 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Fri, 15 Feb 2013 03:15:09 +0100
Subject: [PATCH] set DEBUG from xdebug session before we first use it

---
 lib/base.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/base.php b/lib/base.php
index ba77d0a618..b5439c00ab 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -424,12 +424,6 @@ class OC {
 
 		self::initPaths();
 
-		if (!defined('PHPUNIT_RUN') and !(defined('DEBUG') and DEBUG)) {
-			register_shutdown_function(array('OC_Log', 'onShutdown'));
-			set_error_handler(array('OC_Log', 'onError'));
-			set_exception_handler(array('OC_Log', 'onException'));
-		}
-
 		// set debug mode if an xdebug session is active
 		if (!defined('DEBUG') || !DEBUG) {
 			if (isset($_COOKIE['XDEBUG_SESSION'])) {
@@ -437,6 +431,12 @@ class OC {
 			}
 		}
 
+		if (!defined('PHPUNIT_RUN') and !(defined('DEBUG') and DEBUG)) {
+			register_shutdown_function(array('OC_Log', 'onShutdown'));
+			set_error_handler(array('OC_Log', 'onError'));
+			set_exception_handler(array('OC_Log', 'onException'));
+		}
+
 		// register the stream wrappers
 		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
 		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
-- 
GitLab