1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 18:51:13 +01:00

PHP 8.2 support
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
Daniil Gentili 2022-11-16 17:17:37 +01:00
parent b2955033fc
commit 9fc974b797
5 changed files with 13 additions and 7 deletions

View File

@ -102,7 +102,7 @@ final class WebRunner extends RunnerAbstract
$uri = self::$runPath.'?'.$params;
$payload = "GET $uri HTTP/1.1\r\nHost: ${_SERVER['SERVER_NAME']}\r\n\r\n";
$payload = "GET $uri HTTP/1.1\r\nHost: {$_SERVER['SERVER_NAME']}\r\n\r\n";
// We don't care for results or timeouts here, PHP doesn't count IOwait time as execution time anyway
// Technically should use amphp/socket, but I guess it's OK to not introduce another dependency just for a socket that will be used once.

View File

@ -269,11 +269,11 @@ class Server extends SignalLoop
try {
yield $socket->send([$id, $result]);
} catch (\Throwable $e) {
$this->API->logger("Got error while trying to send result of ${payload[0]}: $e", Logger::ERROR);
$this->API->logger("Got error while trying to send result of {$payload[0]}: $e", Logger::ERROR);
try {
yield $socket->send([$id, new ExitFailure($e)]);
} catch (\Throwable $e) {
$this->API->logger("Got error while trying to send error of error of ${payload[0]}: $e", Logger::ERROR);
$this->API->logger("Got error while trying to send error of error of {$payload[0]}: $e", Logger::ERROR);
}
}
}

View File

@ -349,7 +349,7 @@ trait ResponseHandler
$this->session_id = null;
$this->shared->setTempAuthKey(null);
$this->shared->setPermAuthKey(null);
$this->logger->logger("Auth key not registered in DC {$this->datacenter} with RPC error ${response['error_message']}, resetting temporary and permanent auth keys...", Logger::ERROR);
$this->logger->logger("Auth key not registered in DC {$this->datacenter} with RPC error {$response['error_message']}, resetting temporary and permanent auth keys...", Logger::ERROR);
if ($this->API->authorized_dc == $this->datacenter && $this->API->authorized === MTProto::LOGGED_IN) {
$this->logger->logger('Permanent auth key was main authorized key, logging out...', Logger::FATAL_ERROR);
$this->logger->logger('!!!!!!! WARNING !!!!!!!', Logger::FATAL_ERROR);

View File

@ -99,7 +99,7 @@ class ResponseInfo
$this->serve = $method !== 'HEAD';
if ($seek_start > 0 || $seek_end < $size - 1) {
$this->code = Status::PARTIAL_CONTENT;
$this->headers['Content-Range'] = "bytes ${seek_start}-${seek_end}/${size}";
$this->headers['Content-Range'] = "bytes $seek_start-$seek_end/$size";
$this->headers['Content-Length'] = $seek_end - $seek_start + 1;
} elseif ($size > 0) {
$this->headers['Content-Length'] = $size;

View File

@ -41,10 +41,13 @@ class Installer
public function __construct()
{
if ((PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION < 7) {
throw new \Exception('MadelineProto requires at least PHP 7.1 to run, PHP 8.1+ is recommended.');
throw new \Exception('MadelineProto requires at least PHP 8.1.');
}
if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION === 7) {
trigger_error('MadelineProto requires at least PHP 8.1.');
}
if (PHP_INT_SIZE < 8) {
throw new \Exception('A 64-bit build of PHP is required to run MadelineProto, PHP 8.1+ recommended.');
throw new \Exception('A 64-bit build of PHP is required to run MadelineProto, PHP 8.1 is required.');
}
$backtrace = \debug_backtrace(0);
if (\count($backtrace) === 1) {
@ -171,6 +174,9 @@ class Installer
private static function load($release)
{
if ($release === null) {
if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION === 7) {
throw new \Exception('MadelineProto requires at least PHP 8.1.');
}
throw new \Exception('Could not download MadelineProto, please check your internet connection and PHP configuration!');
}
$phar = "madeline-$release.phar";