Skip to content

PHP 8.5 support#130

Open
maksimovic wants to merge 1 commit intopubnub:masterfrom
maksimovic:upstream-php85-compat
Open

PHP 8.5 support#130
maksimovic wants to merge 1 commit intopubnub:masterfrom
maksimovic:upstream-php85-compat

Conversation

@maksimovic
Copy link
Copy Markdown

Hello. I'm preparing a project for upgrade to PHP 8.5, but couldn't install pubnub/php. Investigating lead to some changes, which I'm proposing here:

CI:

  • Add 8.5 to the test matrix

Installation:

  • Drop the committed composer.lock. The locked behat 3.19 / gherkin 4.12 declare php 8.1.* || 8.2.* || 8.3.* || 8.4.* and refuse to install on 8.5, even though composer.json (php >=8.1) permits it. Resolving fresh from composer.json on 8.5 picks compatible point releases within the same constraints.

src/ deprecation fixes:

  • PaddingTrait::depad() and PubNubCryptoCore::unPadPKCS7() both wrap a string-comparison boolean in ord() which feels like a bug, which surfaced now that passing an empty string to ord() is deprecated (false coerces to "")
  • CryptoModule::decodeHeader() guard "strlen(header < 10)" applies strlen() to the boolean of $header < 10, returning 0 or 1, so it never actually checks header length

Tests:

  • Remove ReflectionMethod::setAccessible(true) calls in tests (deprecated in 8.5, and in fact a no-op since 8.1 anyway).

In fact, the library seems to be in a pretty good shape, but the composer.lock is the first and biggest problem. Its constraints propagate to projects using it, which can have undesired consequences or, like in this case, outright inability to even install it. I see that it's tracked for quite a long time (since v3?), without reasons explaining the tracking.

@pubnub-ops-terraform
Copy link
Copy Markdown

pubnub-ops-terraform commented Apr 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@maksimovic maksimovic force-pushed the upstream-php85-compat branch from a55ea8a to d352dff Compare April 27, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants