From a1a1a3c6429c67e9fa24182cd392e02df4720fb8 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 10 Sep 2017 11:23:40 -0400 Subject: [PATCH] Update UTF-8 check and move to WsServer fixes #517 --- CHANGELOG.md | 2 +- src/Ratchet/App.php | 4 ---- src/Ratchet/WebSocket/WsServer.php | 4 ++++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 959d889..102495d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ========= -###Legend +### Legend * "BC": Backwards compatibility break (from public component APIs) * "BF": Bug fix diff --git a/src/Ratchet/App.php b/src/Ratchet/App.php index 6c084d9..465f270 100644 --- a/src/Ratchet/App.php +++ b/src/Ratchet/App.php @@ -65,10 +65,6 @@ class App { trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING); } - if (3 !== strlen('✓')) { - throw new \DomainException('Bad encoding, length of unicode character ✓ should be 3. Ensure charset UTF-8 and check ini val mbstring.func_autoload'); - } - if (null === $loop) { $loop = LoopFactory::create(); } diff --git a/src/Ratchet/WebSocket/WsServer.php b/src/Ratchet/WebSocket/WsServer.php index 8ded680..88788b5 100644 --- a/src/Ratchet/WebSocket/WsServer.php +++ b/src/Ratchet/WebSocket/WsServer.php @@ -78,6 +78,10 @@ class WsServer implements HttpServerInterface { throw new \UnexpectedValueException('Expected instance of \Ratchet\WebSocket\MessageComponentInterface or \Ratchet\MessageComponentInterface'); } + if (bin2hex('✓') === 'e29c93') { + throw new \DomainException('Bad encoding, length of unicode character ✓ should be 3. Ensure charset UTF-8 and check ini val mbstring.func_autoload'); + } + $this->delegate = $component; $this->connections = new \SplObjectStorage;