This commit is contained in:
Daniil Gentili 2017-04-02 16:43:27 +02:00
commit 4d8ed0582e
5 changed files with 10 additions and 4 deletions

7
a.php
View File

@ -1,7 +1,12 @@
<?php <?php
$payload = base64_decode('NAAAAAAAAAAAAAAAAAAAAAAAAAC06N5YFAAAAHiXRmAwx9DuB28gQszy/RHjhN2RdLkYdQ=='); $payload = base64_decode('NAAAAAAAAAAAAAAAAAAAAAAAAAC06N5YFAAAAHiXRmAwx9DuB28gQszy/RHjhN2RdLkYdQ==');
$socket = fsockopen('tcp://149.154.167.91:443'); // DC 4 $socket = fsockopen('tcp://149.154.167.91:443'); // DC 4
$socket = fsockopen('tcp://149.154.167.50:443'); // DC 2 $socket = fsockopen('tcp://149.154.167.50:443'); // DC 2
stream_set_timeout($socket, 5); stream_set_timeout($socket, 5);
echo 'Wrote '.fwrite($socket, $payload).' bytes'.PHP_EOL; echo 'Wrote '.fwrite($socket, $payload).' bytes'.PHP_EOL;
if (strlen(fread($socket, 100))) echo 'Read 100 bytes from socket'.PHP_EOL; else echo 'No data could be read from socket'.PHP_EOL; if (strlen(fread($socket, 100))) {
echo 'Read 100 bytes from socket'.PHP_EOL;
} else {
echo 'No data could be read from socket'.PHP_EOL;
}

View File

@ -96,7 +96,9 @@ class API extends APIFactory
{ {
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']); set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
$this->setup_threads(); $this->setup_threads();
if (!isset($this->messages)) $this->APIFactory(); if (!isset($this->messages)) {
$this->APIFactory();
}
} }
public function __destruct() public function __destruct()

View File

@ -703,7 +703,6 @@ description: Any json-encodable data
Any json-encodable data.'); Any json-encodable data.');
\danog\MadelineProto\Logger::log(['Done!'], \danog\MadelineProto\Logger::NOTICE); \danog\MadelineProto\Logger::log(['Done!'], \danog\MadelineProto\Logger::NOTICE);
} }
} }

View File

@ -104,7 +104,6 @@ class MTProto
$this->should_serialize = true; $this->should_serialize = true;
} }
public function __wakeup() public function __wakeup()
{ {
if (class_exists('\Thread') && method_exists('\Thread', 'getCurrentThread') && is_object(\Thread::getCurrentThread())) { if (class_exists('\Thread') && method_exists('\Thread', 'getCurrentThread') && is_object(\Thread::getCurrentThread())) {

View File

@ -576,6 +576,7 @@ trait TL
if ($x['_'] === 'dataJSON') { if ($x['_'] === 'dataJSON') {
return json_decode($x['data'], true); return json_decode($x['data'], true);
} }
return $x; return $x;
} }
} }