telegram-api
telegram-api copied to clipboard
Undefined offset: 28 in /var/www/vendor/react/socket/src/HappyEyeBallsConnectionBuilder.php on line 95
Which version are you using?
unreal4u/telegram-api v3.6.0 A complete Telegram bot API implementation written in PHP, with support for inline bots!
Description of problem
Example https://github.com/unreal4u/telegram-api/blob/master/examples/00.send-message-amp.php works without proxy.
And wget works without proxy

But example https://github.com/unreal4u/telegram-api/blob/master/examples/00.send-message.php don't work without proxy
PHP Notice: Undefined offset: 28 in /var/www/vendor/react/socket/src/HappyEyeBallsConnectionBuilder.php on line 95
PHP Stack trace:
PHP 1. {main}() /var/www/ttt.php:0
PHP 2. React\EventLoop\StreamSelectLoop->run() /var/www/ttt.php:23
PHP 3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() /var/www/vendor/react/event-loop/src/StreamSelectLoop.php:212
PHP 4. React\Dns\Query\UdpTransportExecutor->React\Dns\Query\{closure:/var/www/vendor/react/dns/src/Query/UdpTransportExecutor.php:152-184}() /var/www/vendor/react/event-loop/src/StreamSelectLoop.php:245
PHP 5. React\Promise\Deferred->resolve() /var/www/vendor/react/dns/src/Query/UdpTransportExecutor.php:183
PHP 6. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/Deferred.php:36
PHP 7. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 8. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 9. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 10. React\Promise\Timer\{closure:/var/www/vendor/react/promise-timer/src/functions.php:26-32}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
PHP 11. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise-timer/src/functions.php:31
PHP 12. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 13. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 14. React\Promise\FulfilledPromise->done() /var/www/vendor/react/promise/src/Promise.php:135
PHP 15. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:42
PHP 16. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 17. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 18. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 19. React\Dns\Query\RetryExecutor->React\Dns\Query\{closure:/var/www/vendor/react/dns/src/Query/RetryExecutor.php:32-35}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
PHP 20. React\Promise\Deferred->resolve() /var/www/vendor/react/dns/src/Query/RetryExecutor.php:34
PHP 21. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/Deferred.php:36
PHP 22. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 23. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 24. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 25. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
PHP 26. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 27. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 28. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 29. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
PHP 30. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 31. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 32. React\Promise\FulfilledPromise->done() /var/www/vendor/react/promise/src/Promise.php:135
PHP 33. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:42
PHP 34. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 35. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 36. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 37. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
PHP 38. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 39. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 40. React\Promise\FulfilledPromise->done() /var/www/vendor/react/promise/src/Promise.php:135
PHP 41. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:42
PHP 42. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 43. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 44. React\Promise\FulfilledPromise->done() /var/www/vendor/react/promise/src/Promise.php:135
PHP 45. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:229-234}() /var/www/vendor/react/promise/src/FulfilledPromise.php:42
PHP 46. React\Promise\Promise->settle() /var/www/vendor/react/promise/src/Promise.php:231
PHP 47. React\Promise\Promise::React\Promise\{closure:/var/www/vendor/react/promise/src/Promise.php:132-136}() /var/www/vendor/react/promise/src/Promise.php:168
PHP 48. React\Promise\FulfilledPromise->then() /var/www/vendor/react/promise/src/Promise.php:134
PHP 49. React\Socket\HappyEyeBallsConnectionBuilder->React\Socket\{closure:/var/www/vendor/react/socket/src/HappyEyeBallsConnectionBuilder.php:83-101}() /var/www/vendor/react/promise/src/FulfilledPromise.php:28
Undefined offset: 28 in /var/www/vendor/react/socket/src/HappyEyeBallsConnectionBuilder.php on line 95
<?php
use \unreal4u\TelegramAPI\HttpClientRequestHandler;
use \unreal4u\TelegramAPI\TgLog;
use \unreal4u\TelegramAPI\Telegram\Methods\SendMessage;
$str = 'secret';
$i = 00000000000;
require 'vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$handler = new HttpClientRequestHandler($loop);
$tgLog = new TgLog($str, $handler);
$sendMessage = new SendMessage();
$sendMessage->chat_id = $i;
$sendMessage->text = 'Hello world!';
$tgLog->performApiRequest($sendMessage);
$loop->run();
But it works only with proxy:
<?php
use \unreal4u\TelegramAPI\HttpClientRequestHandler;
use \unreal4u\TelegramAPI\TgLog;
use \unreal4u\TelegramAPI\Telegram\Methods\SendMessage;
$str = 'secret';
$i = 00000000000;
$str1 = 'secret';
require 'vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$proxy = new \Clue\React\Socks\Client($str1, new \React\Socket\Connector($loop));
$handler = new HttpClientRequestHandler($loop, [
'tcp' => $proxy,
'timeout' => 3.0,
'dns' => false
]);
$tgLog = new TgLog($str, $handler);
$sendMessage = new SendMessage();
$sendMessage->chat_id = $i;
$sendMessage->text = 'Hello world!';
$tgLog->performApiRequest($sendMessage);
$loop->run();
Hi! Sorry I missed this completely, the Github - Telegram integration didn't seem to work and I see this just now.
This is strange, I see no strange code. What version of React HTTP do you have installed?
composer show --installed | grep react
You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
clue/block-react v1.3.1 Lightweight library that eases integrating async components built for ReactPHP in a traditional, blocking environment.
clue/socks-react v1.0.0 Async SOCKS proxy connector client and server implementation, tunnel any TCP/IP-based protocol through a SOCKS5 or SOCKS4(a) proxy server, built on top of ReactPHP.
react/cache v1.0.0 Async, Promise-based cache interface for ReactPHP
react/dns v1.2.0 Async DNS resolver for ReactPHP
react/event-loop v1.1.1 ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/http-client v0.5.10 Event-driven, streaming HTTP client for ReactPHP
react/promise v2.8.0 A lightweight implementation of CommonJS Promises/A for PHP
react/promise-timer v1.5.1 A trivial implementation of timeouts for Promises, built on top of ReactPHP.
react/socket v1.4.0 Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP
react/stream v1.1.1 Event-driven readable and writable streams for non-blocking I/O in ReactPHP
@4n70w4 Looks like this should be fixed as of https://github.com/reactphp/socket/releases/tag/v1.5.0, in particular https://github.com/reactphp/socket/pull/230, https://github.com/reactphp/socket/pull/231 and https://github.com/reactphp/socket/pull/232 :+1: