Merge pull request #10498 from JMAConsulting/CRM-20722
[civicrm-core.git] / Civi / API / ExternalBatch.php
index 1a2230077ac6e8b4b038bca0908144ebca336bfa..6a8d463e14a19f4aed77b24b22bc7b73c32411e4 100644 (file)
@@ -52,13 +52,18 @@ class ExternalBatch {
     $this->settingsPath = defined('CIVICRM_SETTINGS_PATH') ? CIVICRM_SETTINGS_PATH : NULL;
     $this->defaultParams = $defaultParams;
     $this->env = $_ENV;
+    if (empty($_ENV['PATH'])) {
+      // 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.)');
+    }
   }
 
   /**
    * @param string $entity
    * @param string $action
    * @param array $params
-   * @return $this
+   * @return ExternalBatch
    */
   public function addCall($entity, $action, $params = array()) {
     $params = array_merge($this->defaultParams, $params);