Update HyBi10.php

I encountered the following error while attempting to use Ratchet. The __toString version of the request should contain the proper value, and retrieving the string before converting to an int would prevent this typecasting issue.

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\HyBi10.php on line 7
This commit is contained in:
Barbarrosa 2013-05-31 23:08:27 -06:00
parent 2ac214bc11
commit 7bfa2d054e

View File

@ -4,11 +4,11 @@ use Guzzle\Http\Message\RequestInterface;
class HyBi10 extends RFC6455 { class HyBi10 extends RFC6455 {
public function isProtocol(RequestInterface $request) { public function isProtocol(RequestInterface $request) {
$version = (int)$request->getHeader('Sec-WebSocket-Version', -1); $version = (int)((string)($request->getHeader('Sec-WebSocket-Version', -1)));
return ($version >= 6 && $version < 13); return ($version >= 6 && $version < 13);
} }
public function getVersionNumber() { public function getVersionNumber() {
return 6; return 6;
} }
} }