Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Division by zero in WriteLoop.php #551

Closed
rmiran opened this issue Dec 30, 2018 · 1 comment
Closed

Division by zero in WriteLoop.php #551

rmiran opened this issue Dec 30, 2018 · 1 comment

Comments

@rmiran
Copy link

rmiran commented Dec 30, 2018

hi
please help me!

my php code:

<?php

include 'vendor/autoload.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$me = $MadelineProto->get_self();

\danog\MadelineProto\Logger::log($me);

if (!$me['bot']) {
    $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
    $MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);

    try {
        $MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
    } catch (\danog\MadelineProto\RPCErrorException $e) {
    }

    $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
}
echo 'OK, done!'.PHP_EOL;

and result:

php test.php
You did not define a valid API ID/API hash. Do you want to define it now manually, or automatically? (m/a)
Note that you can also provide the API parameters directly in the code using the settings: https://docs.madelineproto.xyz/docs/SETTINGS.html#settingsapp_infoapi_id
Your choice (m/a): m

  1. Login to my.telegram.org
  2. Go to API development tools
  3. App title: your app's name, can be anything
    Short name: your app's short name, can be anything
    URL: your app/website's URL, or t.me/yourusername
    Platform: anything
    Description: Describe your app here
  4. Click on create application
  5. Enter your API ID:xxxxxxxxxxxxxxxxxx
  6. Enter your API hash: xxxxxxxxxxxxxxxxxxxxxxx
    Logger: MadelineProto
    Logger: Copyright (C) 2016-2018 Daniil Gentili
    Logger: Licensed under AGPLv3
    Logger: https://github.com/danog/MadelineProto
    TL: Loading TL schemes...
    TL: Parsing TL_mtproto_v1.tl...
    TL: CRC32 mismatch (29c1636d, 73f1f8dc) for msg_container#73f1f8dc messages:vector<%Message> = MessageContainer;
    TL: Parsing TL_telegram_v91.tl...
    TL: CRC32 mismatch (402d9b47, 37982646) for ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort;
    TL: CRC32 mismatch (020634ce, 4679b65f) for accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule;
    TL: CRC32 mismatch (066d2808, 5a592a6c) for help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple;
    TL: CRC32 mismatch (450b7115, c88974ac) for channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat;
    TL: Parsing TL_secret.tl...
    TL: Parsing TL_calls.tl...
    TL: CRC32 mismatch (e8201c08, dbf948c1) for decryptedDataBlock#dbf948c1 random_id:long random_bytes:string flags:# voice_call_id:flags.2?int128 in_seq_no:flags.4?int out_seq_no:flags.4?int recent_received_mask:flags.5?int proto:flags.3?int extra:flags.1?string raw_data:flags.0?string = DecryptedDataBlock;
    TL: CRC32 mismatch (d20a6f5c, cc0d0e76) for simpleDataBlock#cc0d0e76 random_id:long random_bytes:string raw_data:string = DecryptedDataBlock;
    TL: Parsing TL_botAPI.tl...
    Connection: Trying connection via tcp://149.154.167.51:443 DC 2, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream
    DataCenter: OK!
    AuthKeyHandler: Generating permanent authorization key for DC 2...
    AuthKeyHandler: Requesting pq...
    ResponseHandler: Trying to assign a response of type ResPQ to its request...
    ResponseHandler: Does the request of return type ResPQ match?
    ResponseHandler: Yes
    ResponseHandler: Deferred: sent resPQ to deferred
    AuthKeyHandler: Automatic factorization failed, trying native CPP module
    AuthKeyHandler: Automatic factorization failed, trying alt py module
    AuthKeyHandler: Automatic factorization failed, trying py module
    AuthKeyHandler: Automatic factorization failed, trying native module
    AuthKeyHandler: Automatic factorization failed, trying wolfram module
    AuthKeyHandler: Factorization 2393698710681780107 = 1234953373 * 1938290759
    RSA: Encrypting with rsa key...
    AuthKeyHandler: Starting Diffie Hellman key exchange
    ResponseHandler: Trying to assign a response of type Server_DH_Params to its request...
    ResponseHandler: Does the request of return type Server_DH_Params match?
    ResponseHandler: Yes
    ResponseHandler: Deferred: sent server_DH_params_ok to deferred
    AuthKeyHandler: Server-client time delta = 0.0 s
    AuthKeyHandler: Executing p/g checks (1/2)...
    AuthKeyHandler: Executing p/g checks (2/2)...
    AuthKeyHandler: Executing g check...
    AuthKeyHandler: Executing g_a check (1/2)...
    AuthKeyHandler: Executing g_a check (2/2)...
    AuthKeyHandler: Generating b...
    AuthKeyHandler: Generating g_b...
    AuthKeyHandler: Executing g_a check (1/2)...
    AuthKeyHandler: Executing g_a check (2/2)...
    AuthKeyHandler: Executing g_b check...
    AuthKeyHandler: Preparing client_DH_inner_data...
    AuthKeyHandler: Executing set_client_DH_params...
    ResponseHandler: Trying to assign a response of type Set_client_DH_params_answer to its request...
    ResponseHandler: Does the request of return type Set_client_DH_params_answer match?
    ResponseHandler: Yes
    ResponseHandler: Deferred: sent dh_gen_ok to deferred
    AuthKeyHandler: Generating authorization key...
    AuthKeyHandler: Diffie Hellman key exchange processed successfully!
    AuthKeyHandler: Auth key generated
    WriteLoop: Writing client info (also executing help.getConfig)...
    Exception: Division by zero in WriteLoop.php:295
    PHP Fatal error: Uncaught danog\MadelineProto\Exception: Division by zero in E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Loop\Connection\WriteLoop.php:295
    Stack trace:
    #0 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Loop\Connection\WriteLoop.php(295): danog\MadelineProto\Exception::ExceptionErrorHandler(2, 'Division by zer...', 'E:\xampp\htdocs...', 295, Array)
    Applied fixes from StyleCI #1 [internal function]: danog\MadelineProto\Loop\Connection\WriteLoop->encryptedWriteLoopAsync()
    Applied fixes from StyleCI #2 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Coroutine.php(112): Generator->send(264)
    Applied fixes from StyleCI #3 E:\xampp\htdocs\madeline\vendor\amphp\amp\lib\Internal\Placeholder.php(43): danog\MadelineProto\Coroutine->danog\MadelineProto{closure}(NULL, 'Y\xB4\xD6b\x15\xC4\xB5\x1C\x03\x00\x00\x00\x01x-...')

#4 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Coroutine.php(147): danog\MadelineProto\Coroutine->onResolve(Object(Closure))
#5 E:\xampp\htdocs\madeline\vendor\da in E:\xampp\htdocs\madeline\vendor\amphp\amp\lib\functions.php on line 172

Fatal error: Uncaught danog\MadelineProto\Exception: Division by zero in E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Loop\Connection\WriteLoop.php:295
Stack trace:
#0 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Loop\Connection\WriteLoop.php(295): danog\MadelineProto\Exception::ExceptionErrorHandler(2, 'Division by zer...', 'E:\xampp\htdocs...', 295, Array)
#1 [internal function]: danog\MadelineProto\Loop\Connection\WriteLoop->encryptedWriteLoopAsync()
#2 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Coroutine.php(112): Generator->send(264)
#3 E:\xampp\htdocs\madeline\vendor\amphp\amp\lib\Internal\Placeholder.php(43): danog\MadelineProto\Coroutine->danog\MadelineProto{closure}(NULL, 'Y\xB4\xD6b\x15\xC4\xB5\x1C\x03\x00\x00\x00\x01x-...')

#4 E:\xampp\htdocs\madeline\vendor\danog\madelineproto\src\danog\MadelineProto\Coroutine.php(147): danog\MadelineProto\Coroutine->onResolve(Object(Closure))
#5 E:\xampp\htdocs\madeline\vendor\da in E:\xampp\htdocs\madeline\vendor\amphp\amp\lib\functions.php on line 172

@rmiran rmiran closed this as completed Dec 31, 2018
@rmiran rmiran reopened this Dec 31, 2018
@rmiran rmiran closed this as completed Dec 31, 2018
@danog
Copy link
Owner

danog commented Dec 31, 2018

Fixed, thanks for reporting!

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

No branches or pull requests

2 participants