From 9c64881929b94be00a777f40ab5ec0f28ea99ea8 Mon Sep 17 00:00:00 2001 From: Barbarrosa Date: Fri, 31 May 2013 22:55:00 -0600 Subject: [PATCH] Fixed type conversion issue with isProtocol method in RFC6455 I encountered the following error while attempting to use Ratchet. The __toString version of the request contained the correct value (13), so I cast the result to a string before casting it to an integer. Notice: Object of class Guzzle\Http\Message\Header could not be converted to int in [file system path]\vendor\cboden\ratchet\src\Ratchet\WebSocket\Version\RFC6455.php on line 53 --- Version/RFC6455.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version/RFC6455.php b/Version/RFC6455.php index 94416c3..aab0435 100644 --- a/Version/RFC6455.php +++ b/Version/RFC6455.php @@ -50,7 +50,7 @@ class RFC6455 implements VersionInterface { * {@inheritdoc} */ public function isProtocol(RequestInterface $request) { - $version = (int)$request->getHeader('Sec-WebSocket-Version', -1); + $version = (int)((string)($request->getHeader('Sec-WebSocket-Version', -1))); return ($this->getVersionNumber() === $version); } @@ -268,4 +268,4 @@ class RFC6455 implements VersionInterface { $this->closeCodes[Frame::CLOSE_SRV_ERR] = true; //$this->closeCodes[Frame::CLOSE_TLS] = true; } -} \ No newline at end of file +}