From bb54faba1198b6d4019dc98a893c28e6f39e93ff Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Mon, 3 Dec 2018 16:50:07 +0100
Subject: [PATCH] Turn off PHP xdebug in CI context

---
 composer.json   | 1 +
 src/Handler.php | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/composer.json b/composer.json
index 4c165ec..051f184 100644
--- a/composer.json
+++ b/composer.json
@@ -27,6 +27,7 @@
         "ext-json": "*",
         "php": ">=5.6",
         "composer-plugin-api": "^1.0.0",
+        "lakedrops/composer-json-utils": "^1.2.0",
         "lakedrops/composer-scripts": "^1.1.0",
         "lakedrops/docker-traefik": "^1.1.0",
         "lakedrops/dotenv": "^1.0.0",
diff --git a/src/Handler.php b/src/Handler.php
index 98b3080..58c1d64 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -242,7 +242,7 @@ class Handler extends BaseHandler {
         ],
         'php' => [
           'version' => '7.0',
-          'xdebug' => 1,
+          'xdebug' => $this->isCiContext() ? 0 : 1,
         ],
         'webserver' => [
           'type' => 'apache',
@@ -288,12 +288,11 @@ class Handler extends BaseHandler {
         ],
       ], $extra['docker4drupal']);
 
-      $projectRoot = getenv('CI_PROJECT_DIR');
-      if (empty($projectRoot)) {
-        $projectRoot = getcwd();
+      if ($this->isCiContext()) {
+        $projectRoot = $this->getDockerMountSource(getenv('CI_PROJECT_DIR'));
       }
       else {
-        $projectRoot = $this->getDockerMountSource($projectRoot);
+        $projectRoot = getcwd();
       }
       $options['projectroot'] = $projectRoot;
 
-- 
GitLab