diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 3356e3dcea..9b29309ad4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -106,19 +106,21 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase @unlink($dbFile); } - public function testReadWriteRead() + public function testReadWriteReadWithNullByte() { + $sessionData = 'da' . "\0" . 'ta'; + $storage = new PdoSessionHandler($this->pdo); $storage->open('', 'sid'); - $data = $storage->read('id'); - $storage->write('id', 'data'); + $readData = $storage->read('id'); + $storage->write('id', $sessionData); $storage->close(); - $this->assertSame('', $data, 'New session returns empty string data'); + $this->assertSame('', $readData, 'New session returns empty string data'); $storage->open('', 'sid'); - $data = $storage->read('id'); + $readData = $storage->read('id'); $storage->close(); - $this->assertSame('data', $data, 'Written value can be read back correctly'); + $this->assertSame($sessionData, $readData, 'Written value can be read back correctly'); } /**