From 48fc113eeb4ce9ab74dd5c8e579ec1da4616bbe3 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 19 Sep 2017 15:44:06 +0300
Subject: [PATCH] Bug fix: only enable tideways when configured to do so.
 (#1035)

- A logic problem caused tideways profiling to be always enabled if the extension was loaded
---
 public/index.php | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/public/index.php b/public/index.php
index 0ffe5e85396..6967aaf957a 100644
--- a/public/index.php
+++ b/public/index.php
@@ -5,12 +5,14 @@ use Zend\Mvc\Service\ServiceManagerConfig;
 
 // If the XHProf profiler is enabled, set it up now:
 $xhprof = getenv('VUFIND_PROFILER_XHPROF');
-if (!empty($xhprof) && extension_loaded('xhprof')) {
-    xhprof_enable();
-} else if (extension_loaded('tideways')) {
-    tideways_enable();
-} else {
-    $xhprof = false;
+if (!empty($xhprof)) {
+    if (extension_loaded('xhprof')) {
+        xhprof_enable();
+    } else if (extension_loaded('tideways')) {
+        tideways_enable();
+    } else {
+        $xhprof = false;
+    }
 }
 
 // Define path to application directory
-- 
GitLab