You are here

public function PdoSessionHandlerTest::testReadWriteReadWithNullByte in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest::testReadWriteReadWithNullByte()

File

vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php, line 121

Class

PdoSessionHandlerTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler

Code

public function testReadWriteReadWithNullByte() {
  $sessionData = 'da' . "\0" . 'ta';
  $storage = new PdoSessionHandler($this
    ->getMemorySqlitePdo());
  $storage
    ->open('', 'sid');
  $readData = $storage
    ->read('id');
  $storage
    ->write('id', $sessionData);
  $storage
    ->close();
  $this
    ->assertSame('', $readData, 'New session returns empty string data');
  $storage
    ->open('', 'sid');
  $readData = $storage
    ->read('id');
  $storage
    ->close();
  $this
    ->assertSame($sessionData, $readData, 'Written value can be read back correctly');
}