Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve compatibility with PHP 8 #4

Open
vasartam opened this issue Oct 21, 2021 · 1 comment
Open

Improve compatibility with PHP 8 #4

vasartam opened this issue Oct 21, 2021 · 1 comment

Comments

@vasartam
Copy link

vasartam commented Oct 21, 2021

I followed the installation instructions as it is mentioned in the README.md:

Download thruway-cli.phar from the latest release.

$ chmod 755 thruway-cli.phar
$ sudo mv thruway-cli.phar /usr/local/bin/thruway-cli

Got some errors upon running a thruway-cli startup command in console with PHP 8.

Steps to reproduce:

  1. Fire up a successfully configured Thruway router:
    php bin/thruway-chat-router.php > /var/www/example.loc/log/chat-thruway-$(date +%Y%m%d_%H%M%S).log
  2. Open up another console window and type:
    thruway-cli ws://example.loc/chat chat

Error text:

$ thruway-cli ws://example.loc/chat chat
Thruway CLI: type help to see a list commands.
PHP Deprecated:  Required parameter $comparer follows optional parameter $initialClock in phar:///usr/local/bin/thruway-cli/vendor/reactivex/rxphp/lib/Rx/Scheduler/VirtualTimeScheduler.php on line 20
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/thruway-cli:0
PHP   2. require() /usr/local/bin/thruway-cli:12
PHP   3. Rx\Thruway\Client->__construct($url = 'ws://example.loc/chat', $realm = 'chat', $options = *uninitialized*, $loop = *uninitialized*, $webSocket = *uninitialized*, $messages = *uninitialized*, $session = *uninitialized*) phar:///usr/local/bin/thruway-cli/bin/thruway:22
PHP   4. Composer\Autoload\ClassLoader->loadClass($class = 'Rx\\Scheduler\\EventLoopScheduler') phar:///usr/local/bin/thruway-cli/vendor/rx/thruway-client/src/Client.php:31
PHP   5. Composer\Autoload\includeFile($file = 'phar:///usr/local/bin/thruway-cli/vendor/composer/../reactivex/rxphp/lib/Rx/Scheduler/EventLoopScheduler.php') phar:///usr/local/bin/thruway-cli/vendor/composer/ClassLoader.php:301
PHP   6. include() phar:///usr/local/bin/thruway-cli/vendor/composer/ClassLoader.php:412
PHP   7. Composer\Autoload\ClassLoader->loadClass($class = 'Rx\\Scheduler\\VirtualTimeScheduler') phar:///usr/local/bin/thruway-cli/vendor/reactivex/rxphp/lib/Rx/Scheduler/EventLoopScheduler.php:7
PHP   8. Composer\Autoload\includeFile($file = 'phar:///usr/local/bin/thruway-cli/vendor/composer/../reactivex/rxphp/lib/Rx/Scheduler/VirtualTimeScheduler.php') phar:///usr/local/bin/thruway-cli/vendor/composer/ClassLoader.php:301
PHP Fatal error:  Declaration of Rx\Subject\ReplaySubject::subscribe(Rx\ObserverInterface $observer, ?Rx\SchedulerInterface $scheduler = null) must be compatible with Rx\Subject\Subject::subscribe(Rx\ObserverInterface $observer, $scheduler = null) in phar:///usr/local/bin/thruway-cli/vendor/reactivex/rxphp/lib/Rx/Subject/ReplaySubject.php on line 64
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/thruway-cli:0
PHP   2. require() /usr/local/bin/thruway-cli:12
PHP   3. Rx\Thruway\Client->__construct($url = 'ws://example.loc/chat', $realm = 'chat', $options = *uninitialized*, $loop = *uninitialized*, $webSocket = *uninitialized*, $messages = *uninitialized*, $session = *uninitialized*) phar:///usr/local/bin/thruway-cli/bin/thruway:22
PHP   4. Rx\Observable\AnonymousObservable->shareReplay($bufferSize = 0, $windowSize = *uninitialized*, $scheduler = *uninitialized*) phar:///usr/local/bin/thruway-cli/vendor/rx/thruway-client/src/Client.php:42
PHP   5. Rx\Observable\AnonymousObservable->replay($selector = NULL, $bufferSize = 0, $windowSize = NULL, $scheduler = NULL) phar:///usr/local/bin/thruway-cli/vendor/reactivex/rxphp/lib/Rx/Observable.php:1283
PHP   6. Composer\Autoload\ClassLoader->loadClass($class = 'Rx\\Subject\\ReplaySubject') phar:///usr/local/bin/thruway-cli/vendor/reactivex/rxphp/lib/Rx/Observable.php:1261
PHP   7. Composer\Autoload\includeFile($file = 'phar:///usr/local/bin/thruway-cli/vendor/composer/../reactivex/rxphp/lib/Rx/Subject/ReplaySubject.php') phar:///usr/local/bin/thruway-cli/vendor/composer/ClassLoader.php:301

Note: all entries of my actual folder name of the site root is replaced with example.loc

I suspect these errors come from the fact I'm using PHP 8 both on my site and in CLI. Would be really great to fix these errors, if this project is maintained. For now I will try testing my router with a few PHP scripts

@davidwdan
Copy link
Member

I'll take a look at this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants