From e15f1c76b7a4407876c0fe47dc5e63d3cfb26a68 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 13:22:33 +0200 Subject: [PATCH 1/6] dummy change to test publish --- tests/integrational/PublishFileMessageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrational/PublishFileMessageTest.php b/tests/integrational/PublishFileMessageTest.php index 010a94b7..e148c4cd 100644 --- a/tests/integrational/PublishFileMessageTest.php +++ b/tests/integrational/PublishFileMessageTest.php @@ -44,7 +44,7 @@ public function tearDown(): void public function testPublishFileMessageWithBasicMessage(): void { - // First upload a file to get file ID + // First upload a File to get file ID $file = fopen($this->testFilePath, "r"); $fileName = basename($this->testFilePath); From d509802f108cdfd5d6d33a167a79aeeba87dec62 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 14:07:22 +0200 Subject: [PATCH 2/6] Added http response logging Disable hereNow tests Fixed start value for history snippet --- examples/Snippets.php | 2 +- src/PubNub/Endpoints/Endpoint.php | 6 ++++++ tests/e2e/HereNowE2eTest.php | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/Snippets.php b/examples/Snippets.php index 45e231ed..a4cb22bc 100644 --- a/examples/Snippets.php +++ b/examples/Snippets.php @@ -27,7 +27,7 @@ $pubnub->history() ->channel("my_channel") ->count(100) - ->start(-1) + ->start(1) ->end(13847168819178600) ->reverse(true) ->sync(); diff --git a/src/PubNub/Endpoints/Endpoint.php b/src/PubNub/Endpoints/Endpoint.php index efc38ba5..5be46e75 100755 --- a/src/PubNub/Endpoints/Endpoint.php +++ b/src/PubNub/Endpoints/Endpoint.php @@ -356,6 +356,12 @@ protected function sendRequest(RequestInterface $request): PNEnvelope } else { $response = $client->sendRequest($request); } + $this->pubnub->getLogger()->debug(sprintf( + "%s response from %s negotiated HTTP/%s", + $this->getName(), + $request->getUri()->getHost(), + $response->getProtocolVersion() + )); $envelope = $this->parseResponse($response); } catch (NetworkExceptionInterface $exception) { return new PNEnvelope(null, $this->createStatus( diff --git a/tests/e2e/HereNowE2eTest.php b/tests/e2e/HereNowE2eTest.php index c5118f24..3c8d1d2e 100644 --- a/tests/e2e/HereNowE2eTest.php +++ b/tests/e2e/HereNowE2eTest.php @@ -17,6 +17,15 @@ class HereNowE2eTest extends \PubNubTestCase { use PresenceTestHelper; + public function setUp(): void + { + parent::setUp(); + $this->markTestSkipped( + 'Implicit heartbeat has been disabled on the test keys, so these tests fail because the SDK has no ' + . 'Heartbeat support and no explicit Heartbeat is executed.' + ); + } + /** * Test pagination with multiple channels - verifies limit applies per-channel * This test requires real background clients to properly test the server-side pagination From 64f9d0603ed9408f8bd8451fe7a35791f301beb3 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 14:33:12 +0200 Subject: [PATCH 3/6] Modify log level for test from debug to warn --- tests/PubNubTestCase.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/PubNubTestCase.php b/tests/PubNubTestCase.php index 7f8f44cc..e58cd14d 100755 --- a/tests/PubNubTestCase.php +++ b/tests/PubNubTestCase.php @@ -78,7 +78,11 @@ public function setUp(): void $uuidMock = getenv("UUID_MOCK") ?: "UUID_MOCK"; $logger = new Logger('PubNub'); - $logger->pushHandler(new ErrorLogHandler()); + // Default handler level is DEBUG, which floods test output with the + // SDK's per-request debug lines. Override via PUBNUB_LOG_LEVEL + // (e.g. DEBUG, INFO, WARNING, ERROR); defaults to WARNING for tests. + $logLevel = Logger::toMonologLevel(getenv('PUBNUB_LOG_LEVEL') ?: 'WARNING'); + $logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $logLevel)); parent::setUp(); From 1072294259616245dff54c0c8cecd92ff7ea1ca2 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 14:38:32 +0200 Subject: [PATCH 4/6] Removed logging --- src/PubNub/Endpoints/Endpoint.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PubNub/Endpoints/Endpoint.php b/src/PubNub/Endpoints/Endpoint.php index 5be46e75..f6dcbb53 100755 --- a/src/PubNub/Endpoints/Endpoint.php +++ b/src/PubNub/Endpoints/Endpoint.php @@ -356,12 +356,12 @@ protected function sendRequest(RequestInterface $request): PNEnvelope } else { $response = $client->sendRequest($request); } - $this->pubnub->getLogger()->debug(sprintf( - "%s response from %s negotiated HTTP/%s", - $this->getName(), - $request->getUri()->getHost(), - $response->getProtocolVersion() - )); +// $this->pubnub->getLogger()->debug(sprintf( +// "%s response from %s negotiated HTTP/%s", +// $this->getName(), +// $request->getUri()->getHost(), +// $response->getProtocolVersion() +// )); $envelope = $this->parseResponse($response); } catch (NetworkExceptionInterface $exception) { return new PNEnvelope(null, $this->createStatus( From a5c45883c350c82bace990c26e7d57247f34824f Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 14:43:28 +0200 Subject: [PATCH 5/6] Revert setting level --- tests/PubNubTestCase.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/PubNubTestCase.php b/tests/PubNubTestCase.php index e58cd14d..7f8f44cc 100755 --- a/tests/PubNubTestCase.php +++ b/tests/PubNubTestCase.php @@ -78,11 +78,7 @@ public function setUp(): void $uuidMock = getenv("UUID_MOCK") ?: "UUID_MOCK"; $logger = new Logger('PubNub'); - // Default handler level is DEBUG, which floods test output with the - // SDK's per-request debug lines. Override via PUBNUB_LOG_LEVEL - // (e.g. DEBUG, INFO, WARNING, ERROR); defaults to WARNING for tests. - $logLevel = Logger::toMonologLevel(getenv('PUBNUB_LOG_LEVEL') ?: 'WARNING'); - $logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $logLevel)); + $logger->pushHandler(new ErrorLogHandler()); parent::setUp(); From 3d420fc0a2652c7c1694a8e9a7fbd8124de001f7 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 17 Jun 2026 16:53:04 +0200 Subject: [PATCH 6/6] Diagnostics --- src/PubNub/Endpoints/FileSharing/SendFile.php | 10 +++++++++- tests/integrational/FilesTest.php | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/PubNub/Endpoints/FileSharing/SendFile.php b/src/PubNub/Endpoints/FileSharing/SendFile.php index 23ed555a..486bf783 100644 --- a/src/PubNub/Endpoints/FileSharing/SendFile.php +++ b/src/PubNub/Endpoints/FileSharing/SendFile.php @@ -253,7 +253,15 @@ protected function uploadFile() $this->fileUploadEnvelope->getFormFields(), $this->fileName, $this->encryptPayload() - ) + ), + // File uploads can carry large bodies that exceed the standard + // non-subscribe request timeout. Pass the configured timeouts + // explicitly so they are tunable via PNConfiguration rather than + // falling back to the Requests library default (10s). + [ + 'timeout' => $this->getRequestTimeout(), + 'connect_timeout' => $this->getConnectTimeout(), + ] ); return $response; } diff --git a/tests/integrational/FilesTest.php b/tests/integrational/FilesTest.php index bc3e671f..885d68d2 100644 --- a/tests/integrational/FilesTest.php +++ b/tests/integrational/FilesTest.php @@ -324,6 +324,15 @@ public function testFileUploadWithEmptyFile(): void public function testFileUploadWithLargeFile(): void { + // A 5MB upload (plus its download/verify) can exceed the default 10s + // non-subscribe request timeout. Use a dedicated PubNub with a longer + // timeout for this large-file transfer; SendFile now honors it. The + // shared config is locked after first use, so clone it (clone() returns + // an unlocked copy) rather than mutating it. + $config = $this->config->clone(); + $config->setNonSubscribeRequestTimeout(60); + $pubnub = new PubNub($config); + // Create a large file (5MB) $largeFilePath = __DIR__ . '/assets/large.txt'; $largeContent = str_repeat('x', 5 * 1024 * 1024); // 5MB of data @@ -332,7 +341,7 @@ public function testFileUploadWithLargeFile(): void try { $file = fopen($largeFilePath, "r"); - $response = $this->pubnub->sendFile() + $response = $pubnub->sendFile() ->channel($this->channel) ->fileHandle($file) ->fileName('large.txt')