From 16719ec28f775d8b9ef447c988409d41107fe74f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 11 Sep 2020 09:30:08 +0200 Subject: [PATCH] Check output buffering level --- .devcontainer/devcontainer.json | 6 ++++-- src/danog/MadelineProto/MTProtoTools/Files.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 862e037b..18f45011 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "dockerfile": "Dockerfile", "args": { // Update VARIANT to pick a PHP version: 7, 7.4, 7.3 - "VARIANT": "7", + "VARIANT": "7.4", "INSTALL_NODE": "true", "NODE_VERSION": "lts/*" } @@ -18,7 +18,9 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ "felixfbecker.php-debug", - "felixfbecker.php-intellisense" + "felixfbecker.php-intellisense", + "getpsalm.psalm-vscode-plugin", + "junstyle.php-cs-fixer" ] // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php index 41c91417..fd176839 100644 --- a/src/danog/MadelineProto/MTProtoTools/Files.php +++ b/src/danog/MadelineProto/MTProtoTools/Files.php @@ -946,8 +946,10 @@ trait Files if (!\in_array($result->getCode(), [Status::OK, Status::PARTIAL_CONTENT])) { yield Tools::echo($result->getCodeExplanation()); } elseif ($result->shouldServe()) { - \ob_end_flush(); - \ob_implicit_flush(); + if (\ob_get_level()) { + \ob_end_flush(); + \ob_implicit_flush(); + } yield from $this->downloadToStream($messageMedia, \fopen('php://output', 'w'), $cb, ...$result->getServeRange()); } }