4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpFoundation\Session\Storage;
14 use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
15 use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
18 * Allows session to be started by PHP and managed by Symfony.
20 * @author Drak <drak@zikula.org>
22 class PhpBridgeSessionStorage extends NativeSessionStorage
27 * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler
28 * @param MetadataBag $metaBag MetadataBag
30 public function __construct($handler = null, MetadataBag $metaBag = null)
32 $this->setMetadataBag($metaBag);
33 $this->setSaveHandler($handler);
39 public function start()
46 if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
47 // This condition matches only PHP 5.3 + internal save handlers
48 $this->saveHandler->setActive(true);
57 public function clear()
59 // clear out the bags and nothing else that may be set
60 // since the purpose of this driver is to share a handler
61 foreach ($this->bags as $bag) {
65 // reconnect the bags to the session