danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.83k stars 654 forks source link

Fatal error: Uncaught \danog\MadelineProto\Exception: danog\Serialization::extractponyobject(): The script tried to execute a method or access a property of an incomplete object #612

Closed NabiKAZ closed 5 years ago

NabiKAZ commented 5 years ago

I use latest commit 6320b2ea89eb183906aa42b3cd4d1ae95e5ac4c5 I just use new \danog\MadelineProto\API.

But get errors:

C:\wamp\www\MadelineProto>php bot.php

Fatal error: Uncaught \danog\MadelineProto\Exception: danog\Serialization::extractponyobject(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "EventHandler" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in C:\wamp\www\MadelineProto\vendor\danog\magicalserializer\src\danog\Serialization.php:46
Revision: 6320b2ea89eb183906aa42b3cd4d1ae95e5ac4c5 (AN UPDATE IS REQUIRED)
TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):

Serialization.php(46):  ExceptionErrorHandler(8,"danog\\Serialization::extractponyobject(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition \"EventHandler\" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition","C:\\wamp\\www\\MadelineProto\\vendor\\danog\\magicalserialize in C:\wamp\www\MadelineProto\vendor\danog\magicalserializer\src\danog\Serialization.php on line 46
C:\wamp\www\MadelineProto>composer info
amphp/amp                        v2.1.1              A non-blocking concurrency framework for PHP applications.
amphp/byte-stream                v1.5.1              A stream abstraction to make working with non-blocking I/O simple.
amphp/cache                      v1.2.0              A promise-aware caching API for Amp.
amphp/dns                        dev-master 861cc85  Async DNS resolution for Amp.
amphp/file                       dev-master 5a69fca  Allows non-blocking access to the filesystem for Amp.
amphp/http                       v1.1.0              Basic HTTP primitives which can be shared by servers and clients.
amphp/log                        v1.0.0              Non-blocking logging for PHP based on Amp and Monolog.
amphp/parallel                   v1.1.1              Parallel processing component for Amp.
amphp/parser                     v1.0.0              A generator parser to make streaming parsers simple.
amphp/process                    v1.1.0              Asynchronous process manager.
amphp/socket                     v0.10.x-dev e90cda8 Async socket connection / server tools for Amp.
amphp/sync                       v1.0.1              Mutex, Semaphore, and other synchronization tools for Amp.
amphp/uri                        dev-master f3195b1  Uri Parser and Resolver.
amphp/websocket                  dev-master db2da8c  Shared code for websocket servers and clients.
amphp/websocket-client           dev-master aff8080  Async WebSocket client for PHP based on Amp.
amphp/windows-registry           v0.3.2              Windows Registry Reader.
cash/lrucache                    1.0.0               An efficient memory-based Least Recently Used (LRU) cache
danog/madelineproto              dev-master 6320b2e  PHP implementation of telegram's MTProto protocol.
danog/magicalserializer          1.0                 Serialize Volatile, Threaded or any other internal PHP class!
danog/primemodule                1.0.3               Prime module capable of doing prime factorization of huge numbers very quickly."
daverandom/libdns                2.x-dev 1ecd825     DNS protocol implementation written in pure PHP
erusev/parsedown                 1.8.0-beta-7        Parser for Markdown.
kint-php/kint                    dev-master c332db9  Kint - debugging tool for PHP developers
league/uri-interfaces            1.1.1               Common interface for URI representation
league/uri-parser                1.4.1               userland URI parser RFC 3986 compliant
league/uri-schemes               1.2.1               URI manipulation library
monolog/monolog                  1.x-dev 4d5b7e6     Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/constant_time_encoding v1.x-dev 2132f0f    Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
paragonie/random_compat          v2.0.18             PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpseclib/phpseclib              dev-master 27370df  PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
psr/http-message                 dev-master f6561bf  Common interface for HTTP messages
psr/log                          dev-master c4421fc  Common interface for logging libraries
rollbar/rollbar                  dev-master 8a57ad9  Monitors errors and exceptions and reports them to Rollbar
symfony/polyfill-ctype           dev-master 82ebae0  Symfony polyfill for ctype functions
vlucas/phpdotenv                 2.6.x-dev 2a7dcf7   Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.

C:\wamp\www\MadelineProto>php -v
PHP 7.2.4 (cli) (built: Mar 28 2018 04:27:01) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
danog commented 5 years ago

Please ensure that the class definition \"EventHandler\" of the object you are trying to operate on was loaded before unserialize() gets called

NabiKAZ commented 5 years ago

@danog As I said, I just use API function, It's source:

<?php
require_once __DIR__ . '/vendor/autoload.php';

$settings = [
    'app_info' => [
        'api_id' => 'xxxxxxxxxxxx',
        'api_hash' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    ],
    'connection_settings' => [
        'all' => [
            'proxy' => '\SocksProxy',
            'proxy_extra' => [
                'address' => '127.0.0.1',
                'port' => '9150',
            ],
        ],
    ],
];

$MadelineProto = new \danog\MadelineProto\API('sessions/nabi.session', $settings);

P.S.: When the issue is still unresolved, why you close it? The users can not reopen it, when you close it.

danog commented 5 years ago

Fixed