Skip to content

Commit

Permalink
[FrameworkBundle] Fixed OutOfBoundException when session handler_id i…
Browse files Browse the repository at this point in the history
…s null

When a null is provided for framework.session.handler_id the FrameworkExtension attempts to set the session storage to null for the 'session.storage.php_bridge' by altering the second argument. According to the session.xml service definition, there is no second argument, and it is in fact the first (read, 0 index) argument that should be changed.
  • Loading branch information
Saem Ghani committed Jun 7, 2013
1 parent df0a02d commit e3561ce
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
Expand Up @@ -319,7 +319,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
if (null == $config['handler_id']) {
// Set the handler class to be null
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
$container->getDefinition('session.storage.php_bridge')->replaceArgument(1, null);
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
} else {
$container->setAlias('session.handler', $config['handler_id']);
}
Expand Down
@@ -0,0 +1,7 @@
<?php

$container->loadFromExtension('framework', array(
'session' => array(
'handler_id' => null,
),
));
@@ -0,0 +1,12 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:session handler-id="null"/>
</framework:config>
</container>
@@ -0,0 +1,3 @@
framework:
session:
handler_id: null
Expand Up @@ -114,6 +114,15 @@ public function testSession()
$this->assertEquals('/path/to/sessions', $container->getParameter('session.save_path'));
}

public function testNullSessionHandler()
{
$container = $this->createContainerFromFile('session');

$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
$this->assertNull($container->getDefinition('session.storage.native')->getArgument(1));
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
}

public function testTemplating()
{
$container = $this->createContainerFromFile('full');
Expand Down

0 comments on commit e3561ce

Please sign in to comment.