diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 04f2c9e4d1..f6fd8d4e06 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -124,6 +124,7 @@ use Silex\Provider\SwiftmailerServiceProvider; use Silex\Provider\UrlGeneratorServiceProvider; use Silex\Provider\ValidatorServiceProvider; use Silex\Provider\ServiceControllerServiceProvider; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Unoconv\UnoconvServiceProvider; use XPDF\PdfToText; use XPDF\XPDFServiceProvider; @@ -275,6 +276,9 @@ class Application extends SilexApplication $this->register(new SessionServiceProvider(), array( 'session.test' => $this->getEnvironment() === static::ENV_TEST )); + $this['session.storage.test'] = $this->share(function($app) { + return new MockArraySessionStorage(); + }); $this->register(new ServiceControllerServiceProvider()); $this->register(new SwiftmailerServiceProvider()); $this->register(new TaskManagerServiceProvider()); diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php index c723ad5853..9ce4113c0b 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpKernel\Event\FilterResponseEvent; class CookiesDisablerSubscriber implements EventSubscriberInterface { - private static $NOSESSION_ROUTES = '/^((\/api\/v1)|(\/permalink))/'; + private static $NOSESSION_ROUTES = '/^((\/api\/v1)|(\/api\/?$)|(\/permalink))/'; private $app; private $sessionCookieEnabled = true; diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriberTest.php b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriberTest.php index fd3446ffe9..e95cf764dd 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriberTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriberTest.php @@ -52,7 +52,8 @@ class CookiesDisablerSubscriberTest extends \PHPUnit_Framework_TestCase return array( array(false, '/prod'), array(false, '/admin'), - array(false, '/api'), + array(true, '/api'), + array(true, '/api/'), array(false, '/api/oauthv2'), array(false, '/'), array(false, '/datafiles/'),