Skip to content

Commit

Permalink
Fixes #6369
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 20, 2015
1 parent 73d4fec commit cfd5bb0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Network/Session/DatabaseSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ public function read($id)
return false;
}

return $result['data'];
if (is_string($result['data'])) {
return $result['data'];
}

return stream_get_contents($result['data']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixture/SessionsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SessionsFixture extends TestFixture
*/
public $fields = [
'id' => ['type' => 'string', 'length' => 128],
'data' => ['type' => 'text', 'null' => true],
'data' => ['type' => 'binary', 'null' => true],
'expires' => ['type' => 'integer', 'length' => 11, 'null' => true],
'_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
];
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Network/Session/DatabaseSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ public function testSerializeEntity()
$entity->value = 'something';
$result = $this->storage->write('key', serialize($entity));
$data = TableRegistry::get('Sessions')->get('key')->data;
$this->assertEquals(serialize($entity), $data);
$this->assertEquals(serialize($entity), stream_get_contents($data));
}
}

0 comments on commit cfd5bb0

Please sign in to comment.