From a30da130e36a9465c7757d2342ce3e28481788d9 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 25 Jul 2021 16:26:20 -0500 Subject: [PATCH 01/13] Add ReturnTypeWillChange attribute to silence PHP 8.1 deprecations --- src/Ratchet/Wamp/Topic.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Ratchet/Wamp/Topic.php b/src/Ratchet/Wamp/Topic.php index bca8f67..675b236 100644 --- a/src/Ratchet/Wamp/Topic.php +++ b/src/Ratchet/Wamp/Topic.php @@ -86,6 +86,7 @@ class Topic implements \IteratorAggregate, \Countable { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return $this->subscribers; } @@ -93,6 +94,7 @@ class Topic implements \IteratorAggregate, \Countable { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return $this->subscribers->count(); } From d239e94d1988e15ca8ebb9a8e58bf6f8ba1eb94d Mon Sep 17 00:00:00 2001 From: Erik Niebla Date: Tue, 30 Nov 2021 18:00:25 -0500 Subject: [PATCH 02/13] Support for PSR7 2.x --- composer.json | 2 +- src/Ratchet/Http/CloseResponseTrait.php | 6 +++--- src/Ratchet/Http/HttpRequestParser.php | 4 ++-- src/Ratchet/Http/Router.php | 6 +++--- src/Ratchet/WebSocket/WsServer.php | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index d89c66e..649d87e 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "php": ">=5.4.2" , "ratchet/rfc6455": "^0.3" , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5" - , "guzzlehttp/psr7": "^1.0" + , "guzzlehttp/psr7": "^1.7|^2.0" , "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0" , "symfony/routing": "^2.6|^3.0|^4.0|^5.0" } diff --git a/src/Ratchet/Http/CloseResponseTrait.php b/src/Ratchet/Http/CloseResponseTrait.php index abdf5c4..c66de29 100644 --- a/src/Ratchet/Http/CloseResponseTrait.php +++ b/src/Ratchet/Http/CloseResponseTrait.php @@ -1,7 +1,7 @@ \Ratchet\VERSION ], $additional_headers)); - $conn->send(gPsr\str($response)); + $conn->send(Message::toString($response)); $conn->close(); } -} \ No newline at end of file +} diff --git a/src/Ratchet/Http/HttpRequestParser.php b/src/Ratchet/Http/HttpRequestParser.php index 9c44114..5043c28 100644 --- a/src/Ratchet/Http/HttpRequestParser.php +++ b/src/Ratchet/Http/HttpRequestParser.php @@ -2,7 +2,7 @@ namespace Ratchet\Http; use Ratchet\MessageInterface; use Ratchet\ConnectionInterface; -use GuzzleHttp\Psr7 as gPsr; +use GuzzleHttp\Psr7\Message; /** * This class receives streaming data from a client request @@ -59,6 +59,6 @@ class HttpRequestParser implements MessageInterface { * @return \Psr\Http\Message\RequestInterface */ public function parse($headers) { - return gPsr\parse_request($headers); + return Message::parseRequest($headers); } } diff --git a/src/Ratchet/Http/Router.php b/src/Ratchet/Http/Router.php index df7fe82..2bd5942 100644 --- a/src/Ratchet/Http/Router.php +++ b/src/Ratchet/Http/Router.php @@ -5,7 +5,7 @@ use Psr\Http\Message\RequestInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use GuzzleHttp\Psr7 as gPsr; +use GuzzleHttp\Psr7\Query; class Router implements HttpServerInterface { use CloseResponseTrait; @@ -61,9 +61,9 @@ class Router implements HttpServerInterface { $parameters[$key] = $value; } } - $parameters = array_merge($parameters, gPsr\parse_query($uri->getQuery() ?: '')); + $parameters = array_merge($parameters, Query::parse($uri->getQuery() ?: '')); - $request = $request->withUri($uri->withQuery(gPsr\build_query($parameters))); + $request = $request->withUri($uri->withQuery(Query::build($parameters))); $conn->controller = $route['_controller']; $conn->controller->onOpen($conn, $request); diff --git a/src/Ratchet/WebSocket/WsServer.php b/src/Ratchet/WebSocket/WsServer.php index 8030604..27795ca 100644 --- a/src/Ratchet/WebSocket/WsServer.php +++ b/src/Ratchet/WebSocket/WsServer.php @@ -14,7 +14,7 @@ use Ratchet\RFC6455\Messaging\CloseFrameChecker; use Ratchet\RFC6455\Handshake\ServerNegotiator; use Ratchet\RFC6455\Handshake\RequestVerifier; use React\EventLoop\LoopInterface; -use GuzzleHttp\Psr7 as gPsr; +use GuzzleHttp\Psr7\Message; /** * The adapter to handle WebSocket requests/responses @@ -116,7 +116,7 @@ class WsServer implements HttpServerInterface { $response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION); - $conn->send(gPsr\str($response)); + $conn->send(Message::toString($response)); if (101 !== $response->getStatusCode()) { return $conn->close(); From c5920ac1ced6cbdf018d4dbe914ca4bb83cc28a5 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 12 Dec 2021 11:19:46 -0500 Subject: [PATCH 03/13] Skip Session tests until ini_set issue resolved --- tests/unit/Session/SessionComponentTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/Session/SessionComponentTest.php b/tests/unit/Session/SessionComponentTest.php index ebfdde4..ea452db 100644 --- a/tests/unit/Session/SessionComponentTest.php +++ b/tests/unit/Session/SessionComponentTest.php @@ -11,6 +11,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; */ class SessionProviderTest extends AbstractMessageComponentTestCase { public function setUp() { + return $this->markTestIncomplete('Test needs to be updated for ini_set issue in PHP 7.2'); + if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) { return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed'); } From 05b1e85365cc91b2aec1a2f6bf05cb47a478cf97 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 12 Dec 2021 11:27:06 -0500 Subject: [PATCH 04/13] Replace futureTick for older versions --- tests/unit/Server/IoServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Server/IoServerTest.php b/tests/unit/Server/IoServerTest.php index e20115f..b2f210d 100644 --- a/tests/unit/Server/IoServerTest.php +++ b/tests/unit/Server/IoServerTest.php @@ -18,7 +18,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase { protected $reactor; protected function tickLoop(LoopInterface $loop) { - $loop->futureTick(function () use ($loop) { + $loop->addTimer(0, function() use ($loop) { $loop->stop(); }); From 6512da0c6c133a1e8992e65fae9642b7a535ab04 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 12 Dec 2021 11:35:34 -0500 Subject: [PATCH 05/13] Lock minimum implicity dependency --- composer.json | 1 + tests/unit/Server/IoServerTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d89c66e..65c0dbe 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "php": ">=5.4.2" , "ratchet/rfc6455": "^0.3" , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5" + , "react/event-loop": ">=0.4" , "guzzlehttp/psr7": "^1.0" , "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0" , "symfony/routing": "^2.6|^3.0|^4.0|^5.0" diff --git a/tests/unit/Server/IoServerTest.php b/tests/unit/Server/IoServerTest.php index b2f210d..0decfcb 100644 --- a/tests/unit/Server/IoServerTest.php +++ b/tests/unit/Server/IoServerTest.php @@ -18,7 +18,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase { protected $reactor; protected function tickLoop(LoopInterface $loop) { - $loop->addTimer(0, function() use ($loop) { + $loop->futureTIck(function () use ($loop) { $loop->stop(); }); From 08480d181131a7f0d8f6cc8d7b128c4af0874e20 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 12 Dec 2021 11:42:12 -0500 Subject: [PATCH 06/13] Fix case on futureTick --- tests/unit/Server/IoServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Server/IoServerTest.php b/tests/unit/Server/IoServerTest.php index 0decfcb..e20115f 100644 --- a/tests/unit/Server/IoServerTest.php +++ b/tests/unit/Server/IoServerTest.php @@ -18,7 +18,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase { protected $reactor; protected function tickLoop(LoopInterface $loop) { - $loop->futureTIck(function () use ($loop) { + $loop->futureTick(function () use ($loop) { $loop->stop(); }); From 409139fabdde2dd16ef443920e670e3192581623 Mon Sep 17 00:00:00 2001 From: Melnikov Alexandr Date: Fri, 20 Oct 2017 11:21:18 +0600 Subject: [PATCH 07/13] Added context to App facade constructor --- src/Ratchet/App.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Ratchet/App.php b/src/Ratchet/App.php index f1cd4dd..d3de200 100644 --- a/src/Ratchet/App.php +++ b/src/Ratchet/App.php @@ -61,8 +61,9 @@ class App { * @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843 * @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine. * @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you. + * @param array $context */ - public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) { + public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) { if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) { trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING); } @@ -74,7 +75,7 @@ class App { $this->httpHost = $httpHost; $this->port = $port; - $socket = new Reactor($address . ':' . $port, $loop); + $socket = new Reactor($address . ':' . $port, $loop, $context); $this->routes = new RouteCollection; $this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop); From 3e97459d3f591d6439ff7cae016e749335b9a047 Mon Sep 17 00:00:00 2001 From: Minifets Date: Fri, 20 Oct 2017 11:34:51 +0600 Subject: [PATCH 08/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index acf4722..fce17ca 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "cboden/ratchet" + "name": "minifets/ratchet" , "type": "library" , "description": "PHP WebSocket library" , "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"] From 5b0194167eac46aec79c6b8ad814c482b93a38fe Mon Sep 17 00:00:00 2001 From: "minifets@DESKTOP-QP6P5N5.localdomain" Date: Fri, 20 Oct 2017 20:40:47 +0600 Subject: [PATCH 09/13] Revert "Update composer.json" This reverts commit 5ebe073fee0f04a7d26aaa0504b0e8b69d0d2e36. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fce17ca..acf4722 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "minifets/ratchet" + "name": "cboden/ratchet" , "type": "library" , "description": "PHP WebSocket library" , "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"] From 3d18955fe7fceb9668c116d662bee2c56768aec2 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 12 Dec 2021 11:58:22 -0500 Subject: [PATCH 10/13] Use latest RFC6455 lib --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index acf4722..3a82de2 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ } , "require": { "php": ">=5.4.2" - , "ratchet/rfc6455": "^0.3" + , "ratchet/rfc6455": "^0.3.1" , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5" , "react/event-loop": ">=0.4" , "guzzlehttp/psr7": "^1.7|^2.0" From 7f1cc6d9d2c44426cf7e32092424f3ac0319056c Mon Sep 17 00:00:00 2001 From: Frank Schreuder Date: Mon, 6 Dec 2021 17:31:23 +0100 Subject: [PATCH 11/13] Add Symfony 6 support --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3a82de2..1dffae6 100644 --- a/composer.json +++ b/composer.json @@ -31,8 +31,8 @@ , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5" , "react/event-loop": ">=0.4" , "guzzlehttp/psr7": "^1.7|^2.0" - , "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0" - , "symfony/routing": "^2.6|^3.0|^4.0|^5.0" + , "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0" + , "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0" } , "require-dev": { "phpunit/phpunit": "~4.8" From 6771d2391df47dbc9a74421728577508adad63f9 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Mon, 13 Dec 2021 19:06:48 -0500 Subject: [PATCH 12/13] Update changelog and version --- CHANGELOG.md | 5 +++++ src/Ratchet/ConnectionInterface.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 624beda..b107075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ CHANGELOG --- +* 0.4.4 (2021-12-11) + * Correct and update dependencies for forward compatibility + * Added context for React Socket server to App + * Use non-deprecated Guzzle API calls + * 0.4.3 (2020-06-04) * BF: Fixed interface acceptable regression in `App` * Update RFC6455 library with latest fixes diff --git a/src/Ratchet/ConnectionInterface.php b/src/Ratchet/ConnectionInterface.php index 13abb07..7213811 100644 --- a/src/Ratchet/ConnectionInterface.php +++ b/src/Ratchet/ConnectionInterface.php @@ -5,7 +5,7 @@ namespace Ratchet; * The version of Ratchet being used * @var string */ -const VERSION = 'Ratchet/0.4.3'; +const VERSION = 'Ratchet/0.4.4'; /** * A proxy object representing a connection to the application From 274054cb53bcd0f77e320cddd4a234d6d1a2492c Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Mon, 13 Dec 2021 19:07:50 -0500 Subject: [PATCH 13/13] Update licence --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9255875..52b4aef 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2020 Chris Boden +Copyright (c) 2011 Chris Boden Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal