Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: php
version: 9.0.0
version: 9.0.1
schema: 1
scm: github.com/pubnub/php
changelog:
- date: 2026-06-22
version: 9.0.1
changes:
- type: feature
text: "Added logging of REST response containing host and negotiated HTTP protocol version. ."
- type: bug
text: "Fixed PubNubServerException handling to guard against a null response and fall back to the full exception message."
- date: 2025-10-30
version: 9.0.0
changes:
Expand Down Expand Up @@ -543,8 +550,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: php-9.0.0.zip
location: https://github.com/pubnub/php/releases/tag/9.0.0
package-name: php-9.0.1.zip
location: https://github.com/pubnub/php/releases/tag/9.0.1
requires:
- name: rmccue/requests
min-version: 1.0.0
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 9.0.1
June 22 2026

#### Added
- Added logging of REST response containing host and negotiated HTTP protocol version. .

#### Fixed
- Fixed PubNubServerException handling to guard against a null response and fall back to the full exception message.

## 9.0.0
October 30 2025

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
{
"require": {
<!-- include the latest version from the badge at the top -->
"pubnub/pubnub": "9.0.0"
"pubnub/pubnub": "9.0.1"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
"homepage": "http://www.pubnub.com/",
"license": "proprietary",
"version": "9.0.0",
"version": "9.0.1",
"authors": [
{
"name": "PubNub",
Expand Down
2 changes: 1 addition & 1 deletion examples/Snippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$pubnub->history()
->channel("my_channel")
->count(100)
->start(-1)
->start(1)
->end(13847168819178600)
->reverse(true)
->sync();
Expand Down
10 changes: 8 additions & 2 deletions src/PubNub/Endpoints/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -368,10 +374,10 @@ protected function sendRequest(RequestInterface $request): PNEnvelope
$statusCode = $exception->getCode();
$response = substr($exception->getMessage(), strpos($exception->getMessage(), "\n") + 1);
$pnServerException = new PubNubServerException();
if (is_callable([$exception, 'getResponse'])) {
if (is_callable([$exception, 'getResponse']) && $exception->getResponse() !== null) {
$response = $exception->getResponse()->getBody()->getContents();
} else {
$response = substr($exception->getMessage(), strpos($exception->getMessage(), "\n") + 1);
$response = $exception->getMessage();
}
$pnServerException->setRawBody($response);
$pnServerException->setStatusCode($exception->getCode());
Expand Down
2 changes: 1 addition & 1 deletion src/PubNub/PubNub.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

class PubNub implements LoggerAwareInterface
{
protected const SDK_VERSION = "9.0.0";
protected const SDK_VERSION = "9.0.1";
protected const SDK_NAME = "PubNub-PHP";

public static $MAX_SEQUENCE = 65535;
Expand Down
3 changes: 2 additions & 1 deletion tests/PubNubTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PubNub\PubNub;
use PubNub\PubNubUtil;
use Monolog\Logger;
use Monolog\Level;
use Monolog\Handler\ErrorLogHandler;

// phpcs:ignore PSR1.Classes.ClassDeclaration
Expand Down Expand Up @@ -78,7 +79,7 @@ public function setUp(): void
$uuidMock = getenv("UUID_MOCK") ?: "UUID_MOCK";

$logger = new Logger('PubNub');
$logger->pushHandler(new ErrorLogHandler());
$logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, Level::Warning));

parent::setUp();

Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/HereNowE2eTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions tests/integrational/FilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,18 @@ public function testFileUploadWithLargeFile(): void
$largeContent = str_repeat('x', 5 * 1024 * 1024); // 5MB of data
file_put_contents($largeFilePath, $largeContent);

$config = new PNConfiguration();
$config->setSubscribeKey(getenv("SUBSCRIBE_KEY") ?: "");
$config->setPublishKey(getenv("PUBLISH_KEY") ?: "");
$config->setUuid(getenv("UUID_MOCK") ?: "UUID_MOCK");
// Use a longer timeout: uploading 5MB can exceed the default 10s
$config->setNonSubscribeRequestTimeout(30);
$pubnub = new PubNub($config);

try {
$file = fopen($largeFilePath, "r");

$response = $this->pubnub->sendFile()
$response = $pubnub->sendFile()
->channel($this->channel)
->fileHandle($file)
->fileName('large.txt')
Expand All @@ -343,7 +351,7 @@ public function testFileUploadWithLargeFile(): void
$this->assertNotEmpty($response->getFileId());

// Verify file can be downloaded
$downloadResponse = $this->pubnub->downloadFile()
$downloadResponse = $pubnub->downloadFile()
->channel($this->channel)
->fileId($response->getFileId())
->fileName('large.txt')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function testHappyPath(): void
->include($includes)
->sync();
$this->checkResponse($addMembers);
sleep(1);

$getMembers = $this->pubnub->getMembers()
->channel($this->channel)
Expand Down
Loading