From 47566c447e90fff4ec4896138d212d7b7a783243 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 29 Dec 2016 13:59:30 -0800 Subject: [PATCH] Civi\API\ExternalBatch - Verify that $_ENV is working This aims to improve error messaging in the situation where a Debian/Ubuntu user runs `api_v3_JobProcessMailingTest` (and, theoretically, in any situation where `ExternalBatch` runs without the required `$_ENV`). For more background, see https://github.com/symfony/symfony/issues/18796 --- Civi/API/ExternalBatch.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Civi/API/ExternalBatch.php b/Civi/API/ExternalBatch.php index 2e6507e66946..5e48a4a3f832 100644 --- a/Civi/API/ExternalBatch.php +++ b/Civi/API/ExternalBatch.php @@ -52,6 +52,11 @@ public function __construct($defaultParams = array()) { $this->settingsPath = defined('CIVICRM_SETTINGS_PATH') ? CIVICRM_SETTINGS_PATH : NULL; $this->defaultParams = $defaultParams; $this->env = $_ENV; + if (empty($_ENV)) { + // FIXME: If we upgrade to newer Symfony\Process and use the newer + // inheritEnv feature, then this becomes unnecessary. + throw new \CRM_Core_Exception('ExternalBatch cannot detect environment: $_ENV is missing. (Tip: Set variables_order=EGPCS in php.ini.)'); + } } /**