Merge branch 'github-master'

This commit is contained in:
Gerrit Drost 2014-05-19 09:20:34 +02:00
commit cdd6296749
4 changed files with 14 additions and 10 deletions

View File

@ -11,4 +11,5 @@ matrix:
- php: hhvm - php: hhvm
before_script: before_script:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "session.serialize_handler = php" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- composer install --dev --prefer-source - composer install --dev --prefer-source

View File

@ -56,14 +56,7 @@ class SessionProvider implements MessageComponentInterface, WsServerInterface {
$this->setOptions($options); $this->setOptions($options);
if (null === $serializer) { if (null === $serializer) {
// Temporarily fixing HHVM issue w/ reading ini values $serialClass = __NAMESPACE__ . "\\Serialize\\{$this->toClassCase(ini_get('session.serialize_handler'))}Handler"; // awesome/terrible hack, eh?
$handler_name = ini_get('session.serialize_handler');
if ('' === $handler_name) {
trigger_error('ini value session.seralize_handler was empty, assuming "php" - tmp hack/fix, bad things might happen', E_USER_WARNING);
$handler_name = 'php';
}
$serialClass = __NAMESPACE__ . "\\Serialize\\{$this->toClassCase($handler_name)}Handler"; // awesome/terrible hack, eh?
if (!class_exists($serialClass)) { if (!class_exists($serialClass)) {
throw new \RuntimeException('Unable to parse session serialize handler'); throw new \RuntimeException('Unable to parse session serialize handler');
} }

View File

@ -77,8 +77,11 @@ class TopicManager implements WsServerInterface, WampServerInterface {
public function onClose(ConnectionInterface $conn) { public function onClose(ConnectionInterface $conn) {
$this->app->onClose($conn); $this->app->onClose($conn);
foreach ($this->topicLookup as $topic) { foreach ($this->topicLookup as $topic => $storage) {
$topic->remove($conn); $storage->remove($conn);
if (0 === $storage->count()) {
unset($this->topicLookup[$topic]);
}
} }
} }

View File

@ -166,12 +166,19 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$method = $class->getMethod('getTopic'); $method = $class->getMethod('getTopic');
$method->setAccessible(true); $method->setAccessible(true);
$attribute = $class->getProperty('topicLookup');
$attribute->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name)); $topic = $method->invokeArgs($this->mngr, array($name));
$this->assertCount(1, $attribute->getValue($this->mngr));
$this->mngr->onSubscribe($this->conn, $name); $this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onClose($this->conn); $this->mngr->onClose($this->conn);
$this->assertFalse($topic->has($this->conn)); $this->assertFalse($topic->has($this->conn));
$this->assertCount(0, $attribute->getValue($this->mngr));
} }
public function testOnErrorBubbles() { public function testOnErrorBubbles() {