diff --git a/module/VuFind/src/VuFind/Cookie/CookieManager.php b/module/VuFind/src/VuFind/Cookie/CookieManager.php index 89760e1cba98b4e79c4adda1a25cebe9609f637d..fb28e15413b1b303caa6a2951e2b316889023967 100644 --- a/module/VuFind/src/VuFind/Cookie/CookieManager.php +++ b/module/VuFind/src/VuFind/Cookie/CookieManager.php @@ -163,8 +163,8 @@ class CookieManager */ public function proxySetCookie() { - // Special case: in test suite -- don't actually write headers! - return defined('VUFIND_PHPUNIT_RUNNING') + // Special case: in test suite or CLI -- don't actually write headers! + return defined('VUFIND_PHPUNIT_RUNNING') || 'cli' === PHP_SAPI ? true : call_user_func_array('setcookie', func_get_args()); } diff --git a/module/VuFind/src/VuFind/Session/ManagerFactory.php b/module/VuFind/src/VuFind/Session/ManagerFactory.php index f61fc2069376761d82b9a0aff21ea5904f1a831c..10757084262fd18370bbbf4e8645d144c01fd70c 100644 --- a/module/VuFind/src/VuFind/Session/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Session/ManagerFactory.php @@ -54,11 +54,12 @@ class ManagerFactory implements FactoryInterface protected function getOptions(ContainerInterface $container) { $cookieManager = $container->get('VuFind\Cookie\CookieManager'); - $options = [ + // Set options only if we are not running from CLI + $options = 'cli' !== PHP_SAPI ? [ 'cookie_httponly' => $cookieManager->isHttpOnly(), 'cookie_path' => $cookieManager->getPath(), 'cookie_secure' => $cookieManager->isSecure() - ]; + ] : []; $domain = $cookieManager->getDomain(); if (!empty($domain)) {