fennb / phirehose

PHP interface to Twitter Streaming API
709 stars 189 forks source link

Call to undefined function socket_last_error #121

Closed inkrement closed 3 years ago

inkrement commented 5 years ago

Today I got the following error... socket_last_error should be a php function, but it seems to be not available?! I am using docker (php:7-cli-alpine).

#3 {main}
  thrown in /www/vendor/fennb/phirehose/lib/Phirehose.php on line 522

Fatal error: Uncaught Error: Call to undefined function socket_last_error() in /www/vendor/fennb/phirehose/lib/Phirehose.php:522
Stack trace:
#0 /www/vendor/spatie/twitter-streaming-api/src/PhirehoseWrapper.php(56): Phirehose->consume()
#1 /www/vendor/spatie/twitter-streaming-api/src/BaseStream.php(37): Spatie\TwitterStreamingApi\PhirehoseWrapper->startListening()
#2 /www/music.php(70): Spatie\TwitterStreamingApi\BaseStream->startListening()
#3 {main}
  thrown in /www/vendor/fennb/phirehose/lib/Phirehose.php on line 522
ahmedofali commented 5 years ago

You'll need to install (or enable) the Socket PHP extension: http://www.php.net/manual/en/sockets.installation.php

jonathantullett commented 3 years ago

@ahmedofali: having installed the sockets extension, the error changes to

Uncaught Error: socket_last_error(): Argument #1 ($socket) must be of type ?Socket, resource given
spideyfusion commented 3 years ago

@jonathantullett This occurs under PHP 8.0. I have created a PR that addresses this issue: https://github.com/fennb/phirehose/pull/126/

fennb commented 3 years ago

Solved as per #126.