diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..aa12b680 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - "master" + schedule: + - cron: "42 3 * * *" + +jobs: + phpunit: + name: "PHPUnit" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "5.4" + - "5.5" + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + dependencies: + - "highest" + include: + - dependencies: "lowest" + php-version: "5.4" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "none" + ini-values: "zend.assertions=1" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "${{ matrix.dependencies }}" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d9ebc7e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - -dist: trusty - -before_script: - - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "session.serialize_handler = php" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - - php -m - - composer install --dev --prefer-source diff --git a/README.md b/README.md index f7118f4c..462f42c9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ratchet -[![Build Status](https://secure.travis-ci.org/ratchetphp/Ratchet.png?branch=master)](http://travis-ci.org/ratchetphp/Ratchet) +[![GitHub Actions][GA Image]][GA Link] [![Autobahn Testsuite](https://img.shields.io/badge/Autobahn-passing-brightgreen.svg)](http://socketo.me/reports/ab/index.html) [![Latest Stable Version](https://poser.pugx.org/cboden/ratchet/v/stable.png)](https://packagist.org/packages/cboden/ratchet) @@ -81,3 +81,7 @@ class MyChat implements MessageComponentInterface { conn.onmessage = function(e) { console.log(e.data); }; conn.onopen = function(e) { conn.send('Hello Me!'); }; ``` + +[GA Image]: https://github.com/ratchetphp/Ratchet/workflows/CI/badge.svg + +[GA Link]: https://github.com/ratchetphp/Ratchet/actions?query=workflow%3A%22CI%22+branch%3Amaster diff --git a/src/Ratchet/Wamp/WampConnection.php b/src/Ratchet/Wamp/WampConnection.php index dda1e4eb..c6a8a112 100644 --- a/src/Ratchet/Wamp/WampConnection.php +++ b/src/Ratchet/Wamp/WampConnection.php @@ -17,7 +17,7 @@ public function __construct(ConnectionInterface $conn) { parent::__construct($conn); $this->WAMP = new \StdClass; - $this->WAMP->sessionId = str_replace('.', '', uniqid(mt_rand(), true)); + $this->WAMP->sessionId = bin2hex(random_bytes(32)); $this->WAMP->prefixes = array(); $this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));